jQuery: The Write Less, Do More JavaScript Library

Ticket #1351 (closed bug: fixed)

Opened 1 year ago

Last modified 1 year ago

Selection of tags slower in 1.1.3 than 1.1.2

Reported by: krudd Assigned to: john
Type: bug Priority: major
Milestone: 1.1.4 Component: core
Version: 1.1.3 Keywords: slow tag selection
Cc: Needs: Review

Description

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:

http://krudd.net/jquery113speed/jquery_elementtest_112.html

Result: setup: 781ms

Here's the same page using 1.1.3:

http://krudd.net/jquery113speed/jquery_elementtest_113.html

Result: setup: 1937ms

And for kicks I looked at using "straight" DOM methods to select the 'inputs' (getElementsByTagName) and 1.1.3:

http://krudd.net/jquery113speed/jquery_elementtest_113_dom.html

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

Change History

Changed 1 year 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.

Changed 1 year ago by john

  • priority changed from minor to major
  • owner set to john
  • milestone set to 1.1.4

Changed 1 year ago by john

  • status changed from new to closed
  • resolution set to fixed

Fixed in SVN rev [2818].

Note: See TracTickets for help on using tickets.