Skip to main content

Bug Tracker

Side navigation

#15059 closed bug (duplicate)

Opened April 28, 2014 08:37AM UTC

Closed April 28, 2014 01:59PM UTC

jQuery 2 $.data slower then jQuery 1

Reported by: jbedard Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.0.0
Keywords: Cc:
Blocked by: Blocking:

I recently tried replacing jQuery 1.10 with 2.0, however I ran into an issue where $.data was taking significantly longer in 2.0. I believe it is almost entirely from the use of Object.defineProperties in the 2.0 Data object, where 1.10 simply did an assignment.

Here's an attempt at comparing just the element expando assignment:

In my actual use case there is also DOM node cloning so the hit is not as drastic as that jsperf, but jQuery 2.0 was adding 200-300ms (about 30%) over jQuery 1.0 with certain datasets.

Is there a strong reason to be using Object.defineProperties/Property in 2.0?

Attachments (0)
Change History (1)

Changed April 28, 2014 01:59PM UTC by dmethvin comment:1

resolution: → duplicate
status: newclosed

Duplicate of #14839.

Unfortunately, a lot of ES5 features are slower than a reasonably equivalent implementation using only ES3 feaures. I'll be interested to see if this continues when ES6 features become widespread as well. Maybe asm.js has it right.