Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
string vs numeric enum values compare -
(version: 1)
Comparing performance of:
string enums vs numeric enums
Created:
one year ago
by:
Guest
Jump to the latest result
Tests:
string enums
const a = { one: 'longLiteralTest', two: 'longLiteralTesT', }; let c = 0; for (let i = 0; i < 100000; i++) { const v = i % 2 === 0 ? a.one : a.two; if (v === a.one) { c++; } }
numeric enums
const a = { one: 1, two: 2, }; let c = 0; for (let i = 0; i < 100000; i++) { const v = i % 2 === 0 ? a.one : a.two; if (v === a.one) { c++; } }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
string enums
numeric enums
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
7 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:143.0) Gecko/20100101 Firefox/143.0
Browser/OS:
Firefox 143 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
string enums
9811.1 Ops/sec
numeric enums
14034.3 Ops/sec
Related benchmarks:
sdfasfasdfabc
more vs not equal
Comparing int to string using loose equality
return the bigger value of two variables
Comparison Check (number VS string)
Which equals operator (== vs === vs != vs !== ) is faster?
array.indexof vs for
string vs numeric enum values compare
string vs numeric enum values compare - v2
Comments
Confirm delete:
Do you really want to delete benchmark?