in reply to Re^2: counting regex hits Benchamark (except)
in thread counting regex hits

I know that it is well-known that tr is faster than m//
Except when it is not.

Point taken: I amend my original proposition with:
if the problem is as simple as the OPs, that is if a simple transliteration is your goal, or a sideeffect of this transliteration, that you may as well use the transliteration operator seems to be a well known fact.

:-)

Congratulations, you've now prematurely optimized this nano-operation.

Do not fall pray to false conclusions:
I was interested in the abstract comparison of two nano-operations and in how to use Benchmark.pm myself, I didn't optimize anything, how could I? I don't have code lying around using any of these oprarators to actually count anything. So as this wasn't optimization, how could it be premature?;-p

I find that the difference is usually more indicative of the practical value of the optmization than the quotient.

this point taken again

kind regards,
tomte


  • Comment on Re: Re^2: counting regex hits Benchamark (except)