I just added some benchmarks here : 
http://dev.rubyonrails.org/attachment/ticket/11264/enumerable_benchmarks.html
This file goes in test/unit with original non-patched Prototype version.
It only benchmarks "each" with empty function as iterator and here are  
some results :

without context, original "each" is slightly faster (negligible imho).
with context argument, patched "each" can be >10 times faster.

This seems to be a really good improvement for Prototype as "each" is  
often used with a context.

Cheers,
Samuel

Le 3 mars 08 à 01:05, Ben Newman a écrit :

>
>> Out of curiosity, could we see proper benchmarks for this ?
>
> I'll put something together as soon as I can.
>
> On Mar 2, 3:41 pm, Tobie Langel <[EMAIL PROTECTED]> wrote:
>> Nice work!
>>
>> Out of curiosity, could we see proper benchmarks for this ?
>>
>> That would be awesome.
>>
>> Best,
>>
>> Tobie
>>
>> On Mar 2, 11:04 pm, kangax <[EMAIL PROTECTED]> wrote:
>>
>>> I like #eachSlice "fix" (to delegate binding to #collect). From  
>>> quick
>>> test, using call over #bind (i.e. invoking method via call vs.
>>> invoking binded method) seems to be almost twice faster (which is
>>> pretty amazing).
>>
>>> Element._visible = Element.visible.bind({ });
>>
>>> console.time('binded');
>>> for (var i=10001; --i;) {
>>>  Element._visible(document.body);}
>>
>>> console.timeEnd('binded');
>>
>>> console.time('call');
>>> for (var i=10001; --i;) {
>>>  Element.visible.call({ }, document.body);}
>>
>>> console.timeEnd('call');
>>
>>> binded: ~400ms
>>> call: ~250ms
>>
>>> On Mar 2, 3:23 pm, Ben Newman <[EMAIL PROTECTED]> wrote:
>>
>>>> Posted this a few minutes ago:
>>
>>>> http://dev.rubyonrails.org/ticket/11264
>>
>>>> The basics:
>>>>  - Simplifies a number of the Enumerable methods.
>>>>  - Avoids using Function#bind where the functionality of
>>>> Function#call is sufficient.
>>>>  - Introduces a convenient new feature: any object that supports a
>>>> "call" method can be used as an iterator.
>>
>>>> The changes made in the patch are pretty conservative, but I think
>>>> similar changes might be appropriate elsewhere in the library, if
>>>> there's consensus on these suggestions.
>>
>>>> Cheers,
>>>> Ben
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" 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/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to