in reply to Speeding up unshift
I am very frustrated in that your patch looks simpler than
my attempt, and yet I'm not sure I understand, probably
because the AvMAX() and AvFILLp() don't
seem to be documented well enough for me to figure out what
they're doing.
And I would personally suggest using the heuristic for slide that I had in my code -- namely:
japhy -- Perl and Regex Hacker
Why do you add num to AvFILLp() (which is the original num with slide added to it) only to then SUBTRACT slide? And what is AvMAX()?!if (num) { i = AvFILLp(av); /* Create extra elements */ /**/ slide = i > 0 ? i : 0; /**/ num += slide; av_extend(av, i + num); AvFILLp(av) += num; ary = AvARRAY(av); Move(ary, ary + num, i + 1, SV*); do { ary[--num] = &PL_sv_undef; } while (num); /* Make extra elements into a buffer */ /**/ AvMAX(av) -= slide; /**/ AvFILLp(av) -= slide; SvPVX(av) = (char*)(AvARRAY(av) + slide); } }
And I would personally suggest using the heuristic for slide that I had in my code -- namely:
Anyway. Sigh. I'm not annoyed at you, but at my inability to patch something that shouldn't have been such a well of annoyance.slide = (i < num && i > 0) ? i : num;
japhy -- Perl and Regex Hacker
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (tilly) 2: Speeding up unshift
by tilly (Archbishop) on Nov 22, 2000 at 19:44 UTC |
In Section
Meditations