in reply to Re^3: Turning foreach into map?
in thread Turning foreach into map?

The other common condition that makes map slower than the equivalent foreach/push is having more output elements than input elements. I'll leave the benchmarking to someone else.

Replies are listed 'Best First'.
Re^5: Turning foreach into map?
by tilly (Archbishop) on Apr 05, 2005 at 00:14 UTC
    I believe that I fixed that in Perl 5.6. (I may have the version of Perl wrong.)
      If so, I apologize for the fud. I remember it coming up at least twice, with patches to curb the worst case behaviour, but thought that each time there was criticism, delay, and finally silence. But my memory is not what it could be.
        I know that I fixed map, and I know that the patch was accepted. But when I tested it again map is slower than foreach for long lists. (Not as badly as it was, however.)

        Looking at the current code, my patch to mapwhile is still in pp_ctl.c. Therefore the current performance problem in map has to be something else than what I was thinking. Do you know any details of what the current issue is?