in reply to RE: always in quest to eliminate temporary variables
in thread always in quest to eliminate temporary variables

I thought about that, but I wasn't sure if $1 qualified as a temporary variable.
  • Comment on RE: RE: always in quest to eliminate temporary variables

Replies are listed 'Best First'.
RE: RE: RE: always in quest to eliminate temporary variables
by merlyn (Sage) on Jun 16, 2000 at 20:13 UTC
    Since "eliminate temporary variables" is an artificial (read: meaningless) requirement, it can be interpreted in arbitrary ways.

    -- Randal L. Schwartz, Perl hacker

      When you say meaningless, do you mean that I was correct in my assumption that temp variables get generated (or not) at the compiler's whim? I know that in C++ compilers temp variables are generated when they are needed and optimized out when they are not. I hope that perl does something similar, which of course eliminates this whole thread, but I don't know.
        I'm saying that until proven, optimizing for "eliminating temporary variables" is likely to be a very pointless optimization. Much more interesting to optimize for minimizing the number of times the data is being copied, or number of opcodes executed, or total memory allocated, or needless actions repeated. "Temporary variables" can either be cheap or expensive, so it's like optimizing to remove the number of vowels in the variable names -- it's a red herring.

        -- Randal L. Schwartz, Perl hacker