Skip to main content

Bug Tracker

Side navigation

#5921 closed enhancement (worksforme)

Opened January 24, 2010 09:10PM UTC

Closed November 19, 2010 08:16AM UTC

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 January 24, 2010 09:11PM UTC.
Change History (1)

Changed November 19, 2010 08:16AM UTC by snover comment:1

resolution: → worksforme
status: newclosed

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