Bug Tracker

Modify

Ticket #5921 (closed enhancement: worksforme)

Opened 3 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

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

Change History

Changed 3 years ago by szopen

comment:1 Changed 3 years ago by snover

  • Status changed from new to closed
  • Resolution set to worksforme

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.