[Prototype-core] Re: Late binding for contextual iterators (patch advertisement)
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 prototype-core@googlegroups.com 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 -~--~~~~--~~--~--~---
[Prototype-core] Re: Late binding for contextual iterators (patch advertisement)
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 prototype-core@googlegroups.com 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 -~--~~~~--~~--~--~---
[Prototype-core] Re: Late binding for contextual iterators (patch advertisement)
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 prototype-core@googlegroups.com 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 -~--~~~~--~~--~--~---