[Chicago-talk] Removing "." from a string?

Steven Lembark lembark at wrkhors.com
Fri Feb 1 15:26:53 PST 2008


Andy_Bach at wiwb.uscourts.gov wrote:
> Did somebody *not* say "benchmark" ;->
>
> # perl /tmp/dot.pl 10000000
> Benchmark: timing 10000000 iterations of joinmatch, splitjoin, subst,
> whileindex...
>  joinmatch:  4 wallclock secs ( 3.09 usr +  0.00 sys =  3.09 CPU) @
> 3236245.95/s (n=10000000)
>  splitjoin:  3 wallclock secs ( 3.23 usr +  0.00 sys =  3.23 CPU) @
> 3095975.23/s (n=10000000)
>      subst:  0 wallclock secs ( 0.91 usr +  0.00 sys =  0.91 CPU) @
> 10989010.99/s (n=10000000)
> whileindex:  3 wallclock secs ( 2.73 usr +  0.00 sys =  2.73 CPU) @
> 3663003.66/s (n=10000000)

index + Substr will always beat the pants of
anything regex for time: it uses a few of the
fastest C calls availale. That's why I knew
what the loop looked like.

Don't know that it's worth the code for stripping
a few dots, however -- unless you have 10_000_000
IP's to process :-)

-- 
Steven Lembark                                          +1 888 359 3508
Workhorse Computing                                       85-09 90th St
lembark at wrkhors.com                                 Woodhaven, NY 11421


More information about the Chicago-talk mailing list