On Mar 13, 12:12 am, "T.J. Crowder" <[email protected]> wrote: > > ...I'd say it's > > a tossup as to how often a bound function will/won't be passed > > arguments.... > > Hmmmm. That would be worth checking. I almost never use bind() with > arguments other than the context; in fact, I don't recall the last > time I did.
But when you call a function returned by bind(), how often are you passing arguments? That's the case I was referring to. It's that case where my variant of the "Kangax" technique performs better. In other words ... // Yes, it's rare to pass extra arguments to bind, like this: var someFunc = foo.bind(obj, 1, 2) // But passing arguments to the bound function, like this, is fairly common: someFunc(3,4) It's this latter case where having the args array cached provides significant performance benefit, which I would argue is worth doing, even if it slightly lessens the performance of "someFunc()" with no arguments. That's the tradeoff we're talking about. --~--~---------~--~----~------------~-------~--~----~ 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 [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-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
