Skip to main content

Bug Tracker

Side navigation

#9481 closed bug (wontfix)

Opened June 01, 2011 09:21AM UTC

Closed July 12, 2011 05:52PM UTC

Performance optimization?

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

Just ran into this via StackOverflow:

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

Attachments (0)
Change History (8)

Changed June 01, 2011 09:37AM UTC by anonymous comment:1

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.

Changed June 01, 2011 09:52AM UTC by comment:2

Ref stackoverflow:

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.

Changed June 01, 2011 02:50PM UTC by dmethvin comment:3

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.

Changed June 01, 2011 06:22PM UTC by dmethvin comment:4

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.

Changed June 01, 2011 06:22PM UTC by dmethvin comment:5

component: unfiledcore

Changed June 08, 2011 04:58PM UTC by dmethvin comment:6

#9525 is a duplicate of this ticket.

Changed June 08, 2011 06:32PM UTC by shadedecho comment:7

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

Changed July 12, 2011 05:52PM UTC by rwaldron comment:8

keywords: → needsreview
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.