Side navigation
#4720 closed enhancement (fixed)
Opened June 03, 2009 12:49AM UTC
Closed November 19, 2010 01:30AM UTC
Performance: Cache array methods for faster accessing
Reported by: | fearphage | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.4 |
Component: | core | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Array.prototype.slice
appears 5 times in jQueryArray.prototype.push
appears 2 times in jQuery
There are several places where the cached value can be reused but are not as well.
These could be cached at the beginning along with window
and undefined
.
var window = this ,undefined ,push = Array.prototype.push ,slice = Array.prototype.slice /* ... snip ... */ if ( toString.call(array) === "[object Array]" ) { Array.prototype.push.apply( ret, array ); } /* ... snip ... */ if ( !prune ) { push.apply( results, checkSet ); } /* ... snip ... */ if ( !inplace ) { result.push.apply( result, ret ); } /* ... snip ... */ slice.call(this); push.call(this, ...); // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push,
Possibly other uses that I haven't caught. Just a general improvement that could be resued over and over and over.
Attachments (0)
Change History (3)
Changed September 17, 2009 02:43PM UTC by comment:1
Changed September 17, 2009 02:50PM UTC by comment:2
The references are made but they are not used. Checking against the nightly:
Array.prototype.slice appears 5 times in the nightly.
Array.prototype.push appears 2 times
Object.prototype.toString appears 2 times.
Changed November 19, 2010 01:30AM UTC by comment:3
resolution: | → fixed |
---|---|
status: | new → closed |
This change has already been made for jQuery 1.3.3. Ticket should be marked as closed.