symbol vs string vs number

Benchmark created on


Setup

const aSymbol = Symbol('1')
const bSymbol = Symbol('2')
const aString = '1'
const bString = '2'
const aNumber = 1
const bNumber = 2
const aLongString = 'thisisareallylongstring'
const bLongString = 'thisisareallylongstring2'

Test runner

Ready to run.

Testing in
TestOps/sec
symbol
if (aSymbol === bSymbol) {
	console.log('the same!')
}
ready
string
if (aString === bString) {
	console.log('the same!')
}
ready
number
if (aNumber === bNumber) {
	console.log('the same!')
}
ready
long string
if (aLongString === bLongString) {
	console.log('the same!')
}
ready

Revisions

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