Ok, how do those optimize anything?  Is it some bug in IE?  He's just
copying a value to a local variable and using that instead and there's a
big speed difference?  What the heck?  I could understand if .length
were a function, and had to recalculate the value each time, but it's
just an attribute.  That's just odd to me.  I wonder if most of the
optimization comes from the RegExp object part.

Greg

> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:rails-spinoffs-
> [EMAIL PROTECTED] On Behalf Of Nicolas Terray
> Sent: Tuesday, December 20, 2005 8:45 AM
> To: rails-spinoffs@lists.rubyonrails.org
> Subject: Re: [Rails-spinoffs] Performance issues with Prototype
> 
> On 12/20/05, Ryan Gahl <[EMAIL PROTECTED]> wrote:
> > Wow, that is some major difference! I know nothing about Sam's plans
or
> > how to get any of this into the official branch, but before I copy
your
> > version into my project, would you mind explaining briefly the
things
> > you changed?
> > Thank you.
> >
> > -Ryan Gahl
> >
> 
> ------8<------------------------
> %> diff prototype.js prototype1.4-opt.js
> 401c401,402
> <     for (var i = 0; i < iterable.length; i++)
> ---
> >     var len = iterable.length;
> >     for (var i = 0; i < len; i++)
> 413c414,415
> <     for (var i = 0; i < this.length; i++)
> ---
> >       var len = this.length;
> >     for (var i = 0; i < len; i++)
> 451c453,454
> <     for (var i = 0; i < this.length; i++)
> ---
> >     var len = this.length;
> >     for (var i = 0; i < len; i++)
> 837c840,841
> <     if (child.className.match(new RegExp("(^|\\s)" + className +
> "(\\s|$)")))
> ---
> >     var re = new RegExp("(^|\\s)" + className + "(\\s|$)");
> >     if (child.className.match(re))
> ------8<------------------------
> 
> That's all !
> 
> 
> It's amazing to see that how 3 little optimizations can improve
> performance!
> Krzysztof, I hope that your patch will be integrated soon because it
> is really usefull...
> 8)
> 
> Thanks,
> Nicolas Terray
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to