Bug Tracker

Opened 10 years ago

Closed 9 years ago

#5299 closed enhancement (wontfix)

odd & even methods improvements

Reported by: dsonet Owned by: john
Priority: minor Milestone: 1.4
Component: selector Version: 1.3
Keywords: division bitwise Cc:
Blocked by: Blocking:

Description

I notice here use % to test if the number is even or odd. I suggest we use bitwise operator here to get the best performance. So, we can rewrite them as:

even: function(elem, i){

return !( i & 1 );

}, odd: function(elem, i){

return ( i & 1 ) === 1;!!(i & 1)

},

Change History (1)

comment:1 Changed 9 years ago by snover

Resolution: wontfix
Status: newclosed

There is no effective performance difference between these two operations. jsperf test

Note: See TracTickets for help on using tickets.