Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Check Variants
(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 ];
Tests:
Map Check
const sizeSize = asd1.get(0b1000_0000) || 0;
Object Check
const sizeSize = asd2[0b1000_0000] || 0
Array Check
const sizeSize = asd3[asd3.indexOf(0b0000_0001)] ?? 0
Current Variant
const firstSizeByte = 0b0000_0001 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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Browser/OS:
Chrome 133 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Map Check
274840928.0 Ops/sec
Object Check
118216200.0 Ops/sec
Array Check
103998432.0 Ops/sec
Current Variant
268651200.0 Ops/sec
Related benchmarks:
Map vs Object 1234
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
test Map vs Object with string which use string as key and value
map VS OBJ
Check Variants 2
Check Variants2
Comments
Confirm delete:
Do you really want to delete benchmark?