Syntactic Confectionery Delight | |
PerlMonks |
Re^3: Regex for Differentiating Underscore and Whitespaceby mwah (Hermit) |
on Nov 04, 2007 at 14:09 UTC ( [id://648868]=note: print w/replies, xml ) | Need Help?? |
blazar: Now, is this test flawed? You are basically correct here. I was too zealous here to advertise the vantages of index() and tr//. They have their run elsewhere, but not in this special case. Thanks for pointing this out. I abused your benchmark code (of course) to find out on how good the index() optimization in Perl5 really is ;-)
On my system, somehow above 60-70K strings - the index() falls behind the c-library function for finding a character (memchr). For the above strings:
I personally believe it'd be much better If I'd read my own posts and think about their assumptions next time much more thoroughly ;-) Regards mwa
In Section
Seekers of Perl Wisdom
|
|