P_rindex => sub { my $x = $X; while (1) { my $i = length($x); (rindex($x," ") == $i ? chop : las +t) }; }, F_rindex => sub { my $x = $Y; while (1) { my $i = length($x); (rindex($x," ") == $i ? chop : las +t) }; },
Benchmark: running F_plus, F_rindex, F_sexeger, F_while, P_plus, P_rin +dex,P_sexeger, P_while, each for at least 5 CPU seconds... F_plus: 6 wallclock secs ( 5.15 usr + 0.00 sys = 5.15 CPU) @ 37 +600.97/s(n=193645) F_rindex: 6 wallclock secs ( 5.45 usr + 0.00 sys = 5.45 CPU) @ 59 +183.30/s(n=322549) F_sexeger: 7 wallclock secs ( 5.24 usr + 0.00 sys = 5.24 CPU) @ 59 +187.60/s(n=310143) F_while: 7 wallclock secs ( 5.29 usr + 0.00 sys = 5.29 CPU) @ 69 +741.02/s(n=368930) P_plus: 5 wallclock secs ( 5.46 usr + 0.00 sys = 5.46 CPU) @ 33 +136.08/s(n=180923) P_rindex: 6 wallclock secs ( 5.31 usr + 0.00 sys = 5.31 CPU) @ 60 +743.69/s(n=322549) P_sexeger: 5 wallclock secs ( 5.36 usr + 0.00 sys = 5.36 CPU) @ 49 +557.65/s(n=265629) P_while: 6 wallclock secs ( 5.09 usr + 0.00 sys = 5.09 CPU) @ 50 +179.17/s(n=255412) Rate P_plus F_plus P_sexeger P_while F_rindex F_sexeger P_ +rindex F_while P_plus 33136/s -- -12% -33% -34% -44% -44% + -45%-52% F_plus 37601/s 13% -- -24% -25% -36% -36% + -38%-46% P_sexeger 49558/s 50% 32% -- -1% -16% -16% + -18%-29% P_while 50179/s 51% 33% 1% -- -15% -15% + -17%-28% F_rindex 59183/s 79% 57% 19% 18% -- -0% + -3%-15% F_sexeger 59188/s 79% 57% 19% 18% 0% -- + -3%-15% P_rindex 60744/s 83% 62% 23% 21% 3% 3% + ---13% F_while 69741/s 110% 85% 41% 39% 18% 18% + 15%--
In reply to Re: japhy blabs about regexes (again)
by MZSanford
in thread japhy blabs about regexes (again)
by japhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |