Bug Tracker

Opened 8 years ago

Closed 8 years ago

#9481 closed bug (wontfix)

Performance optimization?

Reported by: anonymous Owned by:
Priority: low Milestone: 1.next
Component: core Version: 1.6.1
Keywords: needsreview Cc:
Blocked by: Blocking:

Description

Just ran into this via StackOverflow:

https://github.com/matjaz/jquery.fly/

http://jsperf.com/jquery-fly/4

I've no idea on the merit of the code, but an occasional x4 performance seems like an idea worth investigating...

Change History (8)

comment:1 Changed 8 years ago by anonymous

There may actually be some situations where calling the full jQuery constructor is unneccesary. This could actually be of use internally as a micro-optimisation.

comment:2 Changed 8 years ago by holegary@…

Ref stackoverflow: http://stackoverflow.com/questions/6198633/what-is-jquery-fly-plugin-used-for

Could potentially be a reasonable performance gain when iterating over a large number of items, though could cause problems using .context, .selector, etc, although it's worth investigating where jQuery can be cached wherever reasonably possible.

comment:3 Changed 8 years ago by dmethvin

I think this is a pattern to be applied externally, rather than exposed from jQuery core itself. In many $.each loops there may not be a need at all for a jQuery object and creating one unnecessarily would waste time/memory.

comment:4 Changed 8 years ago by dmethvin

Status: newopen

Went through 1.6.1 and there do seem to be some places where we can create one jQuery object outside the scope and just update the single element rather than constructing with jQuery(this). Might be worth a look.

comment:5 Changed 8 years ago by dmethvin

Component: unfiledcore

comment:6 Changed 8 years ago by dmethvin

#9525 is a duplicate of this ticket.

comment:7 Changed 8 years ago by shadedecho

FWIW, I explained over on #9525 that I don't think these two are duplicates, but they are simiilar in spirit.

http://bugs.jquery.com/ticket/9525#comment:4

comment:8 Changed 8 years ago by Rick Waldron

Keywords: needsreview added
Priority: undecidedlow
Resolution: wontfix
Status: openclosed

If this is a pattern that you find useful then feel free to use it, however we feel that this is not a suitable addition to the jQuery Core.

Note: See TracTickets for help on using tickets.