Offset Performance Teaser
The offset method in jQuery is a bit slow … okay … really slow. :) I’ve been working on a new version of the offset method from the ground up largely focusing on performance. I’ve made some good progress and just had to share the results thus far!
The test case is simple. I have a div within a div and both divs have margin, border, padding. I first run the original offset method from jQuery 1.2.6 200 times. Then I run my new version 200 times. The original offset method took 260.823ms to run and the new offset method only took 56.222ms! Not to mention that as it stands right now I’ve cut the code in half from over 90 lines to just over 40 lines.
I can’t wait to get this method finished up and into the core!