> > [Wow, wasn't expecting such a barrage of (great) responses! (I get > this list in digest mode, so find myself scrambling to catch up > here.)]
That tends to happen here :) Rob, those are some VERY impressive numbers you put up in that blog post. I absolutely have to avoid the mailing list today as I'm in a very crunchy crunch time on a project right now... but needless to say, I'll definitely be throwing your implementation into our framework to see what gains we can get (in those places we still have .bind()'s peppered around). Ryan Gahl CEO Nth Penguin, LLC http://www.nthpenguin.com -- Inquire: 1-920-574-2218 Blog: http://www.someElement.com LinkedIn Profile: http://www.linkedin.com/in/ryangahl On Wed, Mar 11, 2009 at 10:29 AM, Robert Kieffer <bro...@gmail.com> wrote: > > [Wow, wasn't expecting such a barrage of (great) responses! (I get > this list in digest mode, so find myself scrambling to catch up > here.)] > > Regarding performance stats: I've just posted some test data over on > my blog... > > http://www.broofa.com/blog/2009/03/prototype-bind-performance > > Basically, it looks like my proposed implementation is 2-3X faster > than Prototype's current solution (stable or trunk). I'm pretty sure > the improvement comes from minimizing the number of function calls > required (by inlining the marshalling of the args array). > > @tobie: sorry, my tests don't show much improvement in the trunk > version performance. Again, the problem is that it's making several > function calls, and those are relatively expensive compared to the > other operations > > @ryan: I see your point about inlining the bind pattern, and I do on > occasion do that, however I've always thought much as kangax does: bind > () provides a consistent, minimal closure for a function, whereas > inlining you get a much more cluttered closure. (i.e. it seems like > bind() is less susceptible to memory leaks. But maybe I'm wrong > there? (Note, too, that "self" may not be such a good name for your > local reference to 'this'. > https://developer.mozilla.org/en/DOM/window.self > . I usually do "var me = this;" instead.) > > @T.J. Crowder - re: unbind() behavior. Yeah, perhaps a different name > would be more appropriate, but I have a hard time thinking of a > legitimate use for unbinging other than to debug something. The 99% > use case for this (I believe) is to do something like, > "myCallback.unbind().toString()" to see what the original method > implementation looks like so you can tell where a callback or event > handler originally came from. At least, that was my rational for the > name/behavior in my example. > > @kangax, re: use of $A, shift, apply - Sure, there's room for other > performance tweaks, but what I care most about is the performance of > invoking a bound function, not in the construction of a bound > function. This is why the function that I return in my implementation > inlines everything except the one apply() call. I suspect the code > you refer to (at the bottom of bug #215) would benefit from the > strategy I use to recycle the args array and marshal the bound args > and passed in arguments together as part of the inline code. > > @Prototype Team: Any suggested next steps with this? (If any?) > > Thanks for all the great feedback. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---