in reply to Why is "any" slow in this case?
my %hash; @hash{0, 15, 16, 31} = (); # then add this to your benchmark hash => sub { while ( $data =~ /^(\d+) (\d+)/mg ) { next if exists $hash{$1} or exists $hash{$2}; return 1; } },
Rate any_cr any ugly ugly_cr hash2 hash any_cr 865/s -- -37% -54% -65% -100% -100% any 1382/s 60% -- -27% -44% -100% -100% ugly 1896/s 119% 37% -- -24% -100% -100% ugly_cr 2489/s 188% 80% 31% -- -100% -100% hash 3084047/s 356493% 222992% 162532% 123813% 26% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why is "any" slow in this case?
by Anonymous Monk on Jul 28, 2025 at 06:39 UTC | |
by sleet (Pilgrim) on Jul 28, 2025 at 07:44 UTC | |
by LanX (Saint) on Jul 28, 2025 at 08:44 UTC | |
|
Re^2: Why is "any" slow in this case?
by Anonymous Monk on Jul 28, 2025 at 11:20 UTC | |
by LanX (Saint) on Jul 28, 2025 at 12:06 UTC | |
by Anonymous Monk on Jul 28, 2025 at 14:04 UTC | |
by LanX (Saint) on Jul 28, 2025 at 14:14 UTC | |
by ysth (Canon) on Jul 28, 2025 at 16:17 UTC | |
by Anonymous Monk on Jul 28, 2025 at 20:20 UTC | |
| |
by LanX (Saint) on Jul 30, 2025 at 22:18 UTC | |
by marto (Cardinal) on Jul 28, 2025 at 11:54 UTC |