in reply to Re: Regex help/condensation
in thread Regex help/condensation
I have to admit I'd prolly have used s/\s+/ /g;, too, but it's something tr is more suited to and reputedly faster for.
tr/ / /s;
Update: I had the time, so figured 'what the heck' ...
Benchmark: running s, tr, each for at least 5 CPU seconds ... s: 5 wallclock secs ( 5.15 usr + 0.01 sys = 5.16 CPU) @ 54047.31/s (n=278722) tr: 5 wallclock secs ( 5.05 usr + 0.00 sys = 5.05 CPU) @ 130668.19/s (n=659613) Rate s tr s 54047/s -- -59% tr 130668/s 142% --
--k.
|
|---|