Skip to main content

Bug Tracker

Side navigation

#1351 closed bug (fixed)

Opened July 04, 2007 12:16AM UTC

Closed August 21, 2007 05:44AM UTC

Selection of tags slower in 1.1.3 than 1.1.2

Reported by: krudd Owned by: john
Priority: major Milestone: 1.1.4
Component: core Version: 1.1.3
Keywords: slow tag selection Cc:
Blocked by: Blocking:

So far I've only looked at the speed decrease when selecting 'input'

elements, so it may be isolated to them or something general.

(You'll need Firebug on Firefox, Firebug lite is included though for other browsers.)

Here's a page with using 1.1.2:

Result: setup: 781ms

Here's the same page using 1.1.3:

Result: setup: 1937ms

And for kicks I looked at using "straight" DOM methods to select the

'inputs' (getElementsByTagName) and 1.1.3:

Result: setup: 531ms

I haven't had time to dig through the 1.1.3 source to see where the

slowdown could be occurring.

Under IE there is a similar, though markedly smaller, slow down

between 1.1.2 and 1.1.3.

Attachments (0)
Change History (3)

Changed July 04, 2007 08:44AM UTC by rformato comment:1

Profiling in firebug, it seems most of the time is spent inside find.

For a simple tag search 4 non trivial and fixed regex are compiled on each find execution. They are:

	reg1: new RegExp("^[/>]\\\\s*(" + jQuery.chars + "+)"),
	reg2: /^((\\/?\\.\\.)|([>\\/+~]))\\s*([a-z]*)/i,
	reg3: new RegExp("^(" + jQuery.chars + "+)(#)(" + jQuery.chars + "+)"),
	reg4: new RegExp("^([#.]?)(" + jQuery.chars + "*)"),

Moving them from find to properties of the jQuery object made 1.1.3 faster then 1.1.2 in my tests on ff for windows.

Changed August 20, 2007 03:12PM UTC by john comment:2

milestone: → 1.1.4
owner: → john
priority: minormajor

Changed August 21, 2007 05:44AM UTC by john comment:3

resolution: → fixed
status: newclosed

Fixed in SVN rev [2818].