On 29-Aug-06, at 1:06 PM, paul wrote:
> Actually, I've just done some tests, and it looks like Queue is even
> faster than array pushing and shifting even with only one element in
> there. From Firebug in Firefox on Linux:
>
>>>> q = new Queue(); t1 = new Date(); for (i = 0; i < 10000; i++)
>>>> { q.put(i); q.get(); }; t2 = new Date(); t2 - t1
> 217
>
>>>> a = new Array(); t1 = new Date(); for (i = 0; i < 10000; i++)
>>>> { a.push(i); a.shift(); }; t2 = new Date(); t2 - t1
> 250
>
> That's kind of surprising to me, but there you go. The difference
> only
> gets more pronounced with collections of larger size.
>
> I haven't measured Stack specifically for speed, but it's written the
> same way, so I expect it performs well.
Could you please attach the Stack/Queue implementations to a ticket?
I'd like to play with them in IE and Safari.
Beau
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---