in reply to Inefficient code in Camel book?

Maybe it's getting localized? The split isn't an array but a list. So it might be keeping two copies of the data.

Don't know enough about perlguts yet but I would think it something to that effect. Plus the difference grows larger with a larger dataset. My guess anyway.

-Lee

"To be civilized is to deny one's nature."

Replies are listed 'Best First'.
Re^2: Page 18 of the Camel
by Aristotle (Chancellor) on Jan 22, 2002 at 17:43 UTC
    I would have to agree here - @grades is a global array, so it gets created and allocated a single time. The list in the foreach on the other hand behaves more like my @grades would. I don't know much about perlguts either, but maybe that would be worth adding as a third benchmark to check?

    Makeshifts last the longest.