Side navigation
#5299 closed enhancement (wontfix)
Opened September 26, 2009 11:56PM UTC
Closed November 02, 2010 12:03AM UTC
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)
},
Attachments (0)
Change History (1)
Changed November 02, 2010 12:03AM UTC by comment:1
resolution: | → wontfix |
---|---|
status: | new → closed |
There is no effective performance difference between these two operations. jsperf test