[Prototype-core] Re: Function.prototype.bind optimization

2009-02-16 Thread kangax

On Feb 16, 8:56 am, Yaffle vic99...@yandex.ru wrote:
 Function.prototype.bind may work 2 times faster, if when calling bind
 with one argument,it would return function without arg.concat

   bind: function() {
     if (arguments.length  2  Object.isUndefined(arguments[0]))
 return this;
     var __method = this, args = $A(arguments), object = args.shift();
         if(arg.length)
       return function() {
         return __method.apply(object, concat($A(arguments)));
       };
     return function(){
       return __method.apply(object, $A(arguments));
     };
   }

 P.S.  bind function used with one argument very frequently

Similar optimization was already done few months ago
http://prototype.lighthouseapp.com/projects/8886/tickets/215-optimize-bind-bindaseventlistener

--
kangax
--~--~-~--~~~---~--~~
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 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: Function.prototype.bind optimization

2009-02-16 Thread Yaffle

Good!
My searching it on lighthouse was not succeful...



kangax:
 On Feb 16, 8:56 am, Yaffle vic99...@yandex.ru wrote:
  Function.prototype.bind may work 2 times faster, if when calling bind
  with one argument,it would return function without arg.concat
 
    bind: function() {
      if (arguments.length  2  Object.isUndefined(arguments[0]))
  return this;
      var __method = this, args = $A(arguments), object = args.shift();
          if(arg.length)
        return function() {
          return __method.apply(object, concat($A(arguments)));
        };
      return function(){
        return __method.apply(object, $A(arguments));
      };
    }
 
  P.S.  bind function used with one argument very frequently

 Similar optimization was already done few months ago
 http://prototype.lighthouseapp.com/projects/8886/tickets/215-optimize-bind-bindaseventlistener

 --
 kangax
--~--~-~--~~~---~--~~
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 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: Function.prototype.bind optimization

2009-02-16 Thread Yaffle


Hm i am stupid.., why this ticket is for  1.6.0.3 milestone?
--~--~-~--~~~---~--~~
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 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---