Bug Tracker

Opened 15 years ago

Closed 14 years ago

#1351 closed bug (fixed)

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.

Change History (3)

comment:1 Changed 15 years ago by rformato

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.

comment:2 Changed 14 years ago by john

Milestone: 1.1.4
Owner: set to john
Priority: minormajor

comment:3 Changed 14 years ago by john

Resolution: fixed
Status: newclosed

Fixed in SVN rev [2818].

Note: See TracTickets for help on using tickets.