a = a[1..]; a += ({ some_value });
^^^^^^^^^^
*removing* elements isn't fast. Adding elements are.
But anyway, I wrote a benchmark for it. It uses v+=({17}) and v[x]=y respectively, up to 100000 elements (k times):
test total user mem (runs) Append array............... 0.808s 0.525s 3540kb (19) (952859/s) Append mapping............. 0.703s 0.459s 3784kb (22) (1090188/s) Append multiset............ 1.132s 0.806s 3684kb (14) (620018/s)
I don't know if it's fast, around one microsecond per insertation... I suspect it might be the function call that is slow, not the insertation in itself - recursed loops gives about the same figures:
Loops Recursed............. 1.337s 1.077s 3680kb (12) (973910 iters/s)
/ Mirar
Previous text:
2003-01-29 01:31: Subject: Re: reasons why pike is better than python?
On Wed, Jan 29, 2003 at 12:55:03AM +0100, Martin Nilsson (Åskblod) @ Pike (-) developers forum wrote:
No, appending elements to arrays are fast in 7.4.
It depends. If it is combined with elemnts removal, epsecially like:
a = a[1..]; a += ({ some_value });
This is quite slow, especially for big arrays :)
No, Pike regexps are faster than e.g. python regexps according to the langauge shootout.
As Martin said already - then Python regexps are slow too. And everyone knows alternative which is faster and powerful, but it is still not in Pike :)
PS: 2 Martin: could you please change the subject to something like: "Reasons why apples are better than oranges?" :)) I think that every language has its advantages and disavantages, which are dependent on task, so... :))
Regards, /Al
/ Brevbäraren