Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Check Variants2
(version: 1)
Comparing performance of:
Map Check vs Object Check vs Array Check vs Current Variant
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const asd1 = new Map().set(0b1000_0000, 1).set(0b0100_0000, 2).set(0b0010_0000, 3).set(0b0001_0000, 4).set(0b0000_1000, 5).set(0b0000_0100, 6).set(0b0000_0010, 7).set(0b0000_0001, 8); const asd2 = { 0b1000_0000: 1, 0b0100_0000: 2, 0b0010_0000: 3, 0b0001_0000: 4, 0b0000_1000: 5, 0b0000_0100: 6, 0b0000_0010: 7, 0b0000_0001: 8 }; const asd3 = [ 0b1000_0000, 0b0100_0000, 0b0010_0000, 0b0001_0000, 0b0000_1000, 0b0000_0100, 0b0000_0010, 0b0000_0001 ]; const firstSizeByte = 0b0000_0001
Tests:
Map Check
const sizeSize = asd1.get(firstSizeByte) || 0;
Object Check
const sizeSize = asd2[firstSizeByte] || 0
Array Check
const sizeSize = asd3[asd3.indexOf(firstSizeByte)] ?? 0
Current Variant
let sizeSize = 0 if(firstSizeByte & 0b1000_0000) sizeSize = 1 else if(firstSizeByte & 0b0100_0000) sizeSize = 2 else if(firstSizeByte & 0b0010_0000) sizeSize = 3 else if(firstSizeByte & 0b0001_0000) sizeSize = 4 else if(firstSizeByte & 0b0000_1000) sizeSize = 5 else if(firstSizeByte & 0b0000_0100) sizeSize = 6 else if(firstSizeByte & 0b0000_0010) sizeSize = 7 else if(firstSizeByte & 0b0000_0001) sizeSize = 8
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Map Check
Object Check
Array Check
Current Variant
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser/OS:
Firefox 138 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Map Check
708894016.0 Ops/sec
Object Check
635119872.0 Ops/sec
Array Check
18966430.0 Ops/sec
Current Variant
73193792.0 Ops/sec
Related benchmarks:
Map vs Object 123456
Inverted map lookup vs. dynamic map lookup vs. Set
Inverted map lookup vs. dynamic map lookup vs. Set1
multiple map iterations
t9834yt9h43
test Map vs Object with string which use string as key and value
map VS OBJ
Check Variants
Check Variants 2
Comments
Confirm delete:
Do you really want to delete benchmark?