I've heard that "my" variables are faster than "local" variables, but I lack the understanding of how things work to assess A) why they're faster, and B) to what degree they'd be faster. My basic question is: is converting a program with all "local" variables in my program to "my" variables going to add any significant performance improvement?
Background: I've been converting a series of 20-150k scripts our company uses to work under use strict to accelerate them with mod_perl. But they use almost all global variables. We've figured out that we can automate 90% of the localizing process with the following TIMTOWTDI hack: create another script to scan through the source code, wrap the whole target script in a subroutine named wrapper which is called once, create declarations for all the formerly implicit global variables making them "local" variables with package name wrapper::variablename. While inelegant, this seemed to be the fastest "time-to-market" approach. But I'm wondering about performance tradeoffs. Given that we have a couple hashes, a dozen arrays and 50-100 scalar variables, I'm trying to figure out if we'd get more than a modest 5-25%-type performance payoff from me spending the time converting these scripts to fully localized my-based ones.
Also, are there other gotchas with this approach that leap out at you?