Ok, so I took some time and read through the patch more completely. It
didn't seem like much had actually changed so I wanted to figure out
the differences. The performance comes from two places:

1) Not using .is(":visible") (that speeds up height/width).
2) Re-organizing inner/outerWidth so that they could fast-path through
the height/width calculations without having to have the dimension be
re-added.

So, I took those two concept and integrated them.

The perf test suite:
http://dev.jquery.com/~john/ticket/3082/

The test suite (passing in all browsers):
http://dev.jquery.com/~john/ticket/3082/test/?eight (height tests)
http://dev.jquery.com/~john/ticket/3082/test/?idth (width tests)

The patch:
http://dev.jquery.com/attachment/ticket/3082/3082.patch

Landing:
http://dev.jquery.com/changeset/6195

The result is even faster than what Mike originally proposed (as you
can see from the perf test suite). I'm seeing 10-20% over Mike's on
height/width, 20-30% on innerHeight/Width, 100% on outerHeight/Width,
and 10-40% on outerHeight/Width(true).

Thanks a ton, Mike, for this set of tweaks - it's a huge win!

--John



On Fri, Feb 13, 2009 at 4:25 PM, John Resig <jere...@gmail.com> wrote:
> Very interesting patch - sorry I apparently missed it/forgot about it
> before. I'm loving the speed improvements (loaded up IE7 and I'm
> seeing 2x+ improvements across the board - along with Firefox, etc.)
>
> There are a bunch of points though that we'll need to take into consideration:
> 1) This isn't actually a patch right now - it's more of a plugin (a
> patch would modify the existing codebase and provide a diff of the
> changes that need to be made).
> 2) The code, as it stands, doesn't match any of the existing coding
> style of jQuery (braces not matching, $ used instead of jQuery, code
> on the same line as an if, not enough spaces around statements).
> 3) Why does $.size exist? Why not just have the functionality be in
> .height()/.width() - or in .curCSS(). I don't see a need for a new
> function here.
> 4) Does it still pass the test suite?
>
> Any progress on this would definitely help to get this patch landed. I
> can take a look at reorganizing all of it eventually - but it might
> just get delayed - you help will make it go faster.
>
> Thanks!
>
> --John
>
>
>
> On Fri, Feb 13, 2009 at 4:00 PM, mike.helgeson <mike.helge...@gmail.com> 
> wrote:
>>
>> I provided a patch about 8 months ago to improve the performance of
>> the core height and width and dimensions inner/outer[height/width]
>> methods.
>>
>> http://groups.google.com/group/jquery-dev/browse_thread/thread/a4becc9a5cc34fea/
>>
>> I put together a test page to help make my point...
>>
>> http://dev.helgeson.info/dimension/
>>
>> I average the following results using FF3/XP...
>> (percentages of the unpatched method time)
>> height & width ~ 73%
>> innerHeight & innerWidth ~ 44%
>> outerHeight & outerWidth ~ 19%
>> outerHeight( true ) & outerWidth( true ) ~ 32%
>>
>> I updated the patch to be compatable with 1.3.x
>>
>> http://dev.jquery.com/ticket/3082
>>
>> In addition to being more efficient, the methods also simplify the API
>> by overloading the height/width methods. By passing in a string
>> ("padding" or "border" or "margin") you get in return, the dimension
>> through that property.
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to