Skip to content

Commit

Permalink
.map named args don't factor into multi-dispatch.
Browse files Browse the repository at this point in the history
The bindability check they caused in multi-dispatch could count for a
lot of overhead if doing a map over a small number of items. This is a
5% saving in the Text::CSV benchmark, for example.
  • Loading branch information
jnthn committed Sep 9, 2015
1 parent fa40403 commit 821d4b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/Any-iterable-methods.pm
Expand Up @@ -19,11 +19,11 @@ augment class Any {

proto method map(|) { * }

multi method map(\SELF: &block, :$label, :$item) {
multi method map(\SELF: █; :$label, :$item) {
sequential-map(as-iterable($item ?? (SELF,) !! SELF).iterator, &block, :$label);
}

multi method map(HyperIterable:D: &block, :$label) {
multi method map(HyperIterable:D: █; :$label) {
# For now we only know how to parallelize when we've only one input
# value needed per block. For the rest, fall back to sequential.
if &block.count != 1 {
Expand Down

0 comments on commit 821d4b7

Please sign in to comment.