Skip to main content

Bug Tracker

Side navigation

#10290 closed feature (wontfix)

Opened September 16, 2011 12:06AM UTC

Closed February 28, 2013 04:49PM UTC

ELEMENT TRAVERSING API

Reported by: markel Owned by:
Priority: low Milestone: 2.0
Component: traversing Version: git
Keywords: Cc:
Blocked by: Blocking:
Description

http://ejohn.org/blog/element-traversal-api/

Three years past, now all major browser are supporting element traversing api. Maybe it's time to reconsider?

In some cases, this properties can noticeable increase iterating speed --

nextAll( http://jsperf.com/element-traversing-nextall-with-obstacles ),

children( http://jsperf.com/element-traversing-children-with-obstacles ),

siblings( http://jsperf.com/element-traversing-siblings-with-obstacles ).

In some cases, speed increase is less noticeable --

nextAll( http://jsperf.com/element-traversing-nextall ),

children( http://jsperf.com/element-traversing-children ),

siblings( http://jsperf.com/element-traversing-siblings ).

Or practically does not exits --

parents( http://jsperf.com/element-traversing-parents-with-obstacles ).

Attachments (0)
Change History (27)

Changed September 16, 2011 12:09AM UTC by markel comment:1

Changed September 16, 2011 01:03AM UTC by anonymous comment:2

The last perftest does not work on ipad,... Type error thrown

Changed September 16, 2011 01:17AM UTC by rwaldron comment:3

component: unfiledtraversing
priority: undecidedlow
resolution: → wontfix
status: newclosed

Three years have passed and we still have to support IE6,7,8 the only difference is that now we're adamantly _not_ writing any more feature code for those browsers.

Changed September 16, 2011 01:33AM UTC by rwaldron comment:4

keywords: → 1.8-discuss
milestone: None1.8

I'm actually reopen this for 1.8 discussion

Changed September 16, 2011 10:34AM UTC by markel comment:5

If browser are supporting new api - we use it, if it don't - we use the old one. Like it shown in pull request. Like it always has, when people start working with new api's.

Changed September 16, 2011 01:57PM UTC by rwaldron comment:6

description: http://ejohn.org/blog/element-traversal-api/ [[BR]] \ Three years past, now all major browser are supporting element traversing api. Maybe it's time to reconsider? \ \ In some cases, this properties can noticeable increase iterating speed -- \ [[BR]] \ nextAll( http://jsperf.com/element-traversing-nextall-with-obstacles ), \ [[BR]] \ children( http://jsperf.com/element-traversing-children-with-obstacles ), \ [[BR]] \ siblings( http://jsperf.com/element-traversing-siblings-with-obstacles ). \ \ In some cases, speed increase is less noticeable -- \ [[BR]] \ nextAll( http://jsperf.com/element-traversing-nextall ), \ [[BR]] \ children( http://jsperf.com/element-traversing-children ), \ [[BR]] \ siblings( http://jsperf.com/element-traversing-siblings ). \ \ Or practically does not exits -- \ [[BR]] \ parents( http://jsperf.com/element-traversing-parents-with-obstacles ). [[BR]] \ Three years past, now all major browser are supporting element traversing api. Maybe it's time to reconsider? \ \ In some cases, this properties can noticeable increase iterating speed -- \ [[BR]] \ nextAll( ), \ [[BR]] \ children( ), \ [[BR]] \ siblings( ). \ \ In some cases, speed increase is less noticeable -- \ [[BR]] \ nextAll( ), \ [[BR]] \ children( ), \ [[BR]] \ siblings( ). \ \ Or practically does not exits -- \ [[BR]] \ parents( ).
resolution: wontfix
status: closedreopened

Changed September 16, 2011 02:59PM UTC by markel comment:7

About iPad thing --

It's nothing wrong with pull request, it's because in test i use "$.noConflict" instead of "jQuery.noConflict"

test here http://jsperf.com/element-traversing-parents-with-obstacles-2 it's should be fine.

Changed September 16, 2011 04:02PM UTC by rwaldron comment:8

Changed September 17, 2011 04:05AM UTC by anonymous comment:9

Rick, in ticket discription all test are fine, except the last one ( and problem exist only on iPad ), without them, you cannot see speed increase, they should be there.

Changed September 17, 2011 04:12AM UTC by anonymous comment:10

And why did you removed reference to the post? Now text looks kinda silly.

Changed September 18, 2011 03:08PM UTC by rwaldron comment:11

Not on purpose, sorry... that seems to happen when I post from my mobile... I'll fix it when I get home from NYC tonight

Changed September 20, 2011 02:21PM UTC by timmywil comment:12

status: reopenedopen

Changed September 28, 2011 02:15AM UTC by dmethvin comment:13

@markel, is there some perf test other than the one in comment 7? It doesn't look like there is any performance benefit.

Changed September 28, 2011 04:54AM UTC by markel comment:14

Yes of cource, test in comment for "parents" method, with it you got nothing, but for others you got something.

See http://bugs.jquery.com/ticket/10290#comment:9

and http://bugs.jquery.com/ticket/10290#comment:11

You can see those test in history of ticket description --

http://bugs.jquery.com/ticket/10290?action=diff&version=6

I guess Rick forgot to update the ticket.

Changed October 14, 2011 03:55PM UTC by dmethvin comment:15

description: [[BR]] \ Three years past, now all major browser are supporting element traversing api. Maybe it's time to reconsider? \ \ In some cases, this properties can noticeable increase iterating speed -- \ [[BR]] \ nextAll( ), \ [[BR]] \ children( ), \ [[BR]] \ siblings( ). \ \ In some cases, speed increase is less noticeable -- \ [[BR]] \ nextAll( ), \ [[BR]] \ children( ), \ [[BR]] \ siblings( ). \ \ Or practically does not exits -- \ [[BR]] \ parents( ).http://ejohn.org/blog/element-traversal-api/ \ \ Three years past, now all major browser are supporting element traversing api. Maybe it's time to reconsider? \ \ In some cases, this properties can noticeable increase iterating speed -- \ \ nextAll( http://jsperf.com/element-traversing-nextall-with-obstacles ), \ \ children( http://jsperf.com/element-traversing-children-with-obstacles ), \ \ siblings( http://jsperf.com/element-traversing-siblings-with-obstacles ). \ \ In some cases, speed increase is less noticeable -- \ \ nextAll( http://jsperf.com/element-traversing-nextall ), \ \ children( http://jsperf.com/element-traversing-children ), \ \ siblings( http://jsperf.com/element-traversing-siblings ). \ \ Or practically does not exits -- \ \ parents( http://jsperf.com/element-traversing-parents-with-obstacles ). \

I restored the links.

Changed December 13, 2011 04:12PM UTC by jaubourg comment:16

description: http://ejohn.org/blog/element-traversal-api/ \ \ Three years past, now all major browser are supporting element traversing api. Maybe it's time to reconsider? \ \ In some cases, this properties can noticeable increase iterating speed -- \ \ nextAll( http://jsperf.com/element-traversing-nextall-with-obstacles ), \ \ children( http://jsperf.com/element-traversing-children-with-obstacles ), \ \ siblings( http://jsperf.com/element-traversing-siblings-with-obstacles ). \ \ In some cases, speed increase is less noticeable -- \ \ nextAll( http://jsperf.com/element-traversing-nextall ), \ \ children( http://jsperf.com/element-traversing-children ), \ \ siblings( http://jsperf.com/element-traversing-siblings ). \ \ Or practically does not exits -- \ \ parents( http://jsperf.com/element-traversing-parents-with-obstacles ). \ http://ejohn.org/blog/element-traversal-api/ \ \ Three years past, now all major browser are supporting element traversing api. Maybe it's time to reconsider?\ \ In some cases, this properties can noticeable increase iterating speed --\ \ nextAll( http://jsperf.com/element-traversing-nextall-with-obstacles ),\ \ children( http://jsperf.com/element-traversing-children-with-obstacles ),\ \ siblings( http://jsperf.com/element-traversing-siblings-with-obstacles ).\ \ In some cases, speed increase is less noticeable --\ \ nextAll( http://jsperf.com/element-traversing-nextall ),\ \ children( http://jsperf.com/element-traversing-children ),\ \ siblings( http://jsperf.com/element-traversing-siblings ).\ \ Or practically does not exits --\ \ parents( http://jsperf.com/element-traversing-parents-with-obstacles ).\

+0, I hate to see a new code path... even if perf is twice as good, what is the actual perf gain in real-life apps?

Changed December 13, 2011 06:23PM UTC by dmethvin comment:17

-1, Isolated perfs look good, but the current code is no slouch and traversing isn't common enough to justify the size increase and extra code paths.

Changed December 13, 2011 07:20PM UTC by markel comment:18

@jaubourg its pretty hard or maybe even not possible to distinguish traversing methods perf, from others methods perf (DOM manipulations, event attach, etc.) in real-live code, you always use them together, because if you travers, you got a reason for it, but it does not mean they will not have final impact on your app, that makes it slow.

@dmethvin maybe you meant that traverse method is not bottleneck in most apps? They very common by themselves.

You already have extra code paths for IE, this is the exactly the same thing. Current code is not a slouch, but like i mentioned before, if you use traverse methods one after another, they might became slow -- http://jsperf.com/etapi-cumulative-effect

Changed December 14, 2011 01:22AM UTC by mikesherov comment:19

-1, I'd need a real world example showing element traversal being the bottleneck in a particular case to support this. All of the perfs mentioned in this ticket are either isolated or contrived. I'm being earnest when I say show me a real example... perhaps I can be swayed.

Changed December 14, 2011 01:37AM UTC by markel comment:20

jQuery.fn.closest and jQuery.fn.parents is good example btw. Very diffrent code paths, very diffrent speed results, jQuery.fn.closest implementation add a lot more extra bytes and jQuery.fn.parents is no slouch too -- http://jsperf.com/closest-vs-parents

And now, can you find a real-life code example that justifies jQuery.fn.closest existence? Apps that bottlenecking on jQuery.fn.parents?

This example is almost exactly like my Element Traversing API implementation.

Even speed results, code paths and amount of bytes is comparable. Same pros, same cons. And yet...

Changed December 14, 2011 04:06PM UTC by timmywil comment:21

-1, fc

Changed December 19, 2011 05:29PM UTC by rwaldron comment:22

description: http://ejohn.org/blog/element-traversal-api/ \ \ Three years past, now all major browser are supporting element traversing api. Maybe it's time to reconsider?\ \ In some cases, this properties can noticeable increase iterating speed --\ \ nextAll( http://jsperf.com/element-traversing-nextall-with-obstacles ),\ \ children( http://jsperf.com/element-traversing-children-with-obstacles ),\ \ siblings( http://jsperf.com/element-traversing-siblings-with-obstacles ).\ \ In some cases, speed increase is less noticeable --\ \ nextAll( http://jsperf.com/element-traversing-nextall ),\ \ children( http://jsperf.com/element-traversing-children ),\ \ siblings( http://jsperf.com/element-traversing-siblings ).\ \ Or practically does not exits --\ \ parents( http://jsperf.com/element-traversing-parents-with-obstacles ).\ http://ejohn.org/blog/element-traversal-api/ \ \ Three years past, now all major browser are supporting element traversing api. Maybe it's time to reconsider? \ \ In some cases, this properties can noticeable increase iterating speed -- \ \ nextAll( http://jsperf.com/element-traversing-nextall-with-obstacles ), \ \ children( http://jsperf.com/element-traversing-children-with-obstacles ), \ \ siblings( http://jsperf.com/element-traversing-siblings-with-obstacles ). \ \ In some cases, speed increase is less noticeable -- \ \ nextAll( http://jsperf.com/element-traversing-nextall ), \ \ children( http://jsperf.com/element-traversing-children ), \ \ siblings( http://jsperf.com/element-traversing-siblings ). \ \ Or practically does not exits -- \ \ parents( http://jsperf.com/element-traversing-parents-with-obstacles ). \

-1

Changed January 18, 2012 03:31AM UTC by dmethvin comment:23

keywords: 1.8-discuss
milestone: 1.8None
resolution: → wontfix
status: openclosed

Vote result was negative for 1.8.

Changed July 06, 2012 09:17PM UTC by dmethvin comment:24

resolution: wontfix
status: closedreopened

Reopening for possible inclusion in 2.0; Orkel has volunteered.

Changed July 06, 2012 09:18PM UTC by dmethvin comment:25

milestone: None2.0
status: reopenedopen

Changed September 09, 2012 01:11AM UTC by dmethvin comment:26

type: enhancementfeature

Bulk change from enhancement to feature.

Changed February 28, 2013 04:49PM UTC by markelog comment:27

resolution: → wontfix
status: openclosed

Fix was commited to 2.0 beta (65bdfbf), but it was reverted, see #13265.