in reply to Re: Re^2: Array How to/Performance
in thread Array How to/Performance: mass initialization or update using array slice

"Pedalogical"? If you mean pathological - then yes. :) If you mean pegagogical, then so-so with a grain of maybe.

This being as "micro" an optimization as it is, it is not likely you will be able to say it will be faster than something else in any particular case. If you can do more work than initializing the array in a loop, then using the slice method to fill it up front may possibly end up being slightly slower, f.ex. In any case this is not going to make a significant difference. The bottom line is that either way you turn it, you'll have to benchmark it for your data and your algorithm.

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re^4: Array How to/Performance
by Itatsumaki (Friar) on Jun 21, 2003 at 21:29 UTC

    Hmm... that was a dumb typo -- should be pedagogic. Just for grins, here goes:

    • Pedagogic = about teaching
    • Pedologic = about children
    • Pedologic = study of soil (alternate)

    Anyways, I think BrowserUk's answer and the OP's subsequent benchmark have value in understanding both the internals and what kind of things might be good suspects for optimization in other programs. Personally I wouldn't have known this to be such a drastically micro-optimization without doing a benchmark.