Skip to main content

Bug Tracker

Side navigation

#8024 closed bug (fixed)

Opened January 20, 2011 01:29PM UTC

Closed January 20, 2011 08:12PM UTC

Last modified January 20, 2011 08:15PM UTC

Sizzle Performance Regression

Reported by: rwaldron Owned by:
Priority: blocker Milestone: 1.5
Component: selector Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
Attachments (0)
Change History (4)

Changed January 20, 2011 02:34PM UTC by jitter comment:1

_comment0: That sounds strange to me as 1.4.3 specifically included an update to Sizzle to '''improve''' the performance of element rooted queries. Also the [http://blog.jquery.com/2010/10/16/jquery-143-released/ blog post] on the 1.4.3 release documents [http://www.flickr.com/photos/jeresig/5078513793/ improvements on the performance of .find]1295534217423541

That sounds strange to me as 1.4.3 specifically included an update to Sizzle to improve the performance of element rooted queries. Also the blog post on the 1.4.3 release documents improvements on the performance of .find. Maybe we need a jsperf test on this

Changed January 20, 2011 03:25PM UTC by petersendidit comment:2

Changed January 20, 2011 08:12PM UTC by danheberden comment:3

resolution: → fixed
status: newclosed

Changed January 20, 2011 08:15PM UTC by john comment:4

component: unfiledselector
milestone: 1.next1.5
priority: undecidedblocker

So yeah - this was from moving to using qSA in jQuery 1.4.3. qSA(".class") is slower than doing getElementsByClassName("class") (which is what Sizzle would use internally). Amusingly the case of jQuery(".class") would/has been always using qSA if possible so that would've been "slow" for them as well.

I've moved some perf improvements from jQuery into Sizzle and added a ".class" check and quickly use getElementsByClassName if it exists. This will help to make the code faster in all browsers (and for other projects that use Sizzle).