map { $module->target($_); my $results = $module->process(); (); } @objects; #### use Benchmark 'cmpthese'; my @objects = (1 .. 100_000); cmpthese( -1, { map1 => sub { map { my $xyz = $_ + 1000; undef $xyz; } @objects; 1; }, map2 => sub { map { my $xyz = $_ + 1000; (); } @objects; 1; }, for => sub { for (@objects) { my $xyz = $_ + 1000; undef $xyz } 1; } }); __END__ Benchmark: running for, map1, map2 for at least 1 CPU seconds... for: 1 wallclock secs ( 1.10 usr + 0.01 sys = 1.11 CPU) @ 11.71/s (n=13) map1: 1 wallclock secs ( 1.08 usr + 0.00 sys = 1.08 CPU) @ 7.41/s (n=8) map2: 2 wallclock secs ( 1.06 usr + 0.00 sys = 1.06 CPU) @ 10.38/s (n=11) Rate map1 map2 for map1 7.41/s -- -29% -37% map2 10.4/s 40% -- -11% for 11.7/s 58% 13% --