Number() vs parseInt() and === VS string === (v75)

Revision 75 of this benchmark created by Mario Karagiorgas on


Description

Check whether string comparisons of integer values is faster than converting first to integers.

Test runner

Ready to run.

Testing in
TestOps/sec
Number
Number("101") === 101
ready
parseInt
parseInt("101") === 101
ready
"101" == 101
"101" == 101
ready
"101" === "101"
"101" === "101"
ready
101 == 101
101 == 101
ready
'101' === 101 + ''
'101' === 101 + ''
ready
101 + '' === '101'
101 + '' === '101'
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.