in reply to Re: Re: Re: Alternatives to split?
in thread Alternatives to split?
as well as substr and index stuff($tag)=split (/\|/,$data,2);
I then benchmarked them$tag=substr ($data,0,index($data,'\|',));
should split be slow compared to substr?Benchmark: timing 1000000 iterations of split, substr... split: 8 wallclock secs ( 6.93 usr + 0.00 sys = 6.93 CPU) @ 14 +4279.32/s(n=1000000) substr: 1 wallclock secs ( 1.54 usr + 0.00 sys = 1.54 CPU) @ 64 +8088.14/s(n=1000000)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
5Re: Alternatives to split?
by jeffa (Bishop) on Sep 03, 2003 at 13:26 UTC |