Bug Tracker

Opened 10 years ago

Closed 9 years ago

#5921 closed enhancement (worksforme)

nextUntil to slow (possibly all *Until functions)

Reported by: szopen Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.4
Keywords: nextUntil, slow Cc:
Blocked by: Blocking:

Description

I've done some superficial speed tests that could be found at http://pastebin.com/f561045be

It turns out, that possibly nextUntil isn't as fast as it could be. See pastebin or attachment for details.

For example the code

var obj = $(this).parent().children();
var start = obj.index(this) + 1;
var end   = obj.index($(this).nextAll('h1:first'));
if ( end == -1 ) {
	slice = obj.slice(start);
} else {
	slice = obj.slice(start,end);
}

is ~3 times faster than

slice = $(this).nextUntil('h1');

I suggest to perform some more tests, especially on large data sets. I suggest on making some more tests esp. on larger data sets.

Attachments (1)

test.html (4.0 KB) - added by szopen 10 years ago.

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by szopen

Attachment: test.html added

comment:1 Changed 9 years ago by snover

Resolution: worksforme
Status: newclosed

Please comment if this is still an issue in current versions of jQuery.

Note: See TracTickets for help on using tickets.