Closed
Bug 537548
Opened 15 years ago
Closed 15 years ago
Add Array.isArray
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
DUPLICATE
of bug 510537
People
(Reporter: kangax, Unassigned)
Details
Array.isArray is specified in (now-finalized) ES5 (see 15.4.3.2) and is present in nightly WebKit, Opera 10.5 pre-alpha and latest builds of Chrome 4.
All of these native implementations are significantly faster than custom one, such as, for example:
Array.isArray = function isArray(o) {
Object.prototype.toString.call(o) === '[object Array]';
};
WebKit is up to 17 times faster, Opera — up to 5 times, etc.
Implementing Array.isArray in Mozilla could be beneficial for scripts and libraries that use helper similar to the above (Prototype.js and jQuery definitely have it, other libraries probably have it too).
Thank you.
Reporter | ||
Comment 1•15 years ago
|
||
Here's a simple test I used for performance comparison — http://yura.thinkweb2.com/jstests/native_vs_custom_Array_isArray_perf_test.html
And this looks like a relevant test suite for Array.isArray in V8 — http://code.google.com/p/v8/source/browse/branches/bleeding_edge/test/mjsunit/third_party/array-isarray.js?spec=svn3060&r=3060
Updated•15 years ago
|
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•