Bug Tracker

Opened 6 years ago

Closed 6 years ago

#14333 closed bug (notabug)

Use the native Array.filter method in jQuery.grep (jQuery 2.x)

Reported by: ameyms Owned by:
Priority: low Milestone: None
Component: core Version: 2.0.3
Keywords: Cc:
Blocked by: Blocking:

Description

This is safe to do since jQuery 2.x only supports ES5 compliant browsers

Change History (4)

comment:1 Changed 6 years ago by dmethvin

Even Android 2.3?

comment:2 Changed 6 years ago by timmywil

Component: unfiledcore
Priority: undecidedlow
Status: newopen

Yup, just checked. It seems Android 2.3 has it as well. However, it shouldn't be assumed without testing that native filter is faster than looping.

comment:3 Changed 6 years ago by ameyms

jsPerf indicates native filtering is ~17% slower than for loop based

http://jsperf.com/array-filter-vs-for-loop

I think this ticket can be closed. I have also closed the corresponding PR.

Last edited 6 years ago by ameyms (previous) (diff)

comment:4 Changed 6 years ago by dmethvin

Resolution: notabug
Status: openclosed
Note: See TracTickets for help on using tickets.