From 821d4b7bfb29101224989b62f50b921c07fe30d8 Mon Sep 17 00:00:00 2001 From: jnthn Date: Wed, 9 Sep 2015 15:40:20 +0200 Subject: [PATCH] .map named args don't factor into multi-dispatch. 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. --- src/core/Any-iterable-methods.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/Any-iterable-methods.pm b/src/core/Any-iterable-methods.pm index 125e38cfa83..3beffa5ca2b 100644 --- a/src/core/Any-iterable-methods.pm +++ b/src/core/Any-iterable-methods.pm @@ -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 {