You're right, though, wrapping the fetch of @fixedLocaltime in a sub (returning a ref to the array) call kills the performance of the strftime variant a bit more.
$ perl testMonth.pl Benchmark: running inlineArrayLookup, preBuiltArrayLookup, strftimeLoo +kup, strftimeSubLookup, substrLookup, each for at least 2 CPU seconds +... inlineArrayLookup: 2 wallclock secs ( 2.12 usr + 0.00 sys = 2.12 CP +U) @ 513847.17/s (n=1089356) preBuiltArrayLookup: 2 wallclock secs ( 2.09 usr + 0.01 sys = 2.10 +CPU) @ 568700.00/s (n=1194270) strftimeLookup: 1 wallclock secs ( 1.81 usr + 0.35 sys = 2.16 CPU) +@ 223003.24/s (n=481687) strftimeSubLookup: 2 wallclock secs ( 1.74 usr + 0.26 sys = 2.00 CP +U) @ 182455.50/s (n=364911) substrLookup: 2 wallclock secs ( 2.19 usr + 0.01 sys = 2.20 CPU) @ +446835.91/s (n=983039) Rate strftimeSubLookup strftimeLookup substrLo +okup inlineArrayLookup preBuiltArrayLookup strftimeSubLookup 182455/s -- -18% +-59% -64% -68% strftimeLookup 223003/s 22% -- +-50% -57% -61% substrLookup 446836/s 145% 100% + -- -13% -21% inlineArrayLookup 513847/s 182% 130% + 15% -- -10% preBuiltArrayLookup 568700/s 212% 155% + 27% 11% --
Edit by tye, change PRE to CODE around long lines
In reply to Re: Re: Replacing $mon with Jan, Feb, Mar by regex or other means
by RMGir
in thread Replacing $mon with Jan, Feb, Mar by regex or other means
by jonnyfolk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |