Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Modulo VS bitwise AND for finding odd number
(version: 1)
Comparing performance of:
Modulo vs bitwise AND
Created:
one year ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function getRandomArray() { const arr = []; for (let i = 0; i < 10000; i++) { Math.floor(Math.random() * 100000) + 1; } return arr; } var randomArr = getRandomArray()
Tests:
Modulo
const x = randomArr.map(x => x % 2 === 1)
bitwise AND
const y = randomArr.map(x => x & 1 === 1)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Modulo
bitwise AND
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0
Browser/OS:
Firefox 145 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Modulo
119274240.0 Ops/sec
bitwise AND
120793960.0 Ops/sec
Related benchmarks:
slice test
Lodash vs. Native (find)
Lodash vs. Native (remove/filter)
Lodash ceil vs JS native Math.ceil (2022)
remove test2
Lodash vs. Native (filter)
gigi becali's test
gigi becal2i's test
Pack array of bitmasks (numbers)
Comments
Confirm delete:
Do you really want to delete benchmark?