We don't bite newbies here... much | |
PerlMonks |
Re: Re: Difference between tr// and s///?by HyperZonk (Friar) |
on Feb 06, 2004 at 16:19 UTC ( [id://327116]=note: print w/replies, xml ) | Need Help?? |
Hmmm ... it seems to me that your benchmarks are actually indicating that tr/// is slower than s///. Not what I would have expected, and apparently no one else did either, since despite the evidence, everyone is claiming that this test shows that tr/// is faster. Update: I just ran the benchmark on my ActiveState build and got similar results ... that, strangely, s appears to be nearly twice as fast as tr in this trivial example. Results showing only about 1 million tr's per second vs. almost 2 million s's per second:
Just for background, this is ActivePerl 5.8.0 build 806. UPDATE Update: Thanks to davido for pointing us in the right direction on this in the CB before he posted his node. Now we have the same string for the benchmark tests! And the results are as expected:
Boy, do I feel stupid for not seeing that!
In Section
Seekers of Perl Wisdom
|
|