in reply to Re: Re: Finding all substrings
in thread Finding all substrings
Some repeated benchmarking answers this . . .
my is expensive. Removing the my and making $strlen a global eliminates the diferrence for the small test case. The bench about the same. Multiplying the length of the test string by ten and leaving $strlen global gives thelenm's sub big gains over the orginal - %6-%10. Finally, making $strlen lexical and retesting reduces those gains by %4-%8, still testing with "Just Another Perl Hacker,"x10.
So, yes, this is definately an optimization.
Cheers,
|
|---|