String Speed Comparison

Benchmark created by djD-REK on


Test runner

Ready to run.

Testing in
TestOps/sec
Double quotes
const hello = "Hello world!"
ready
Single quotes
const hello = 'Hello world!'
ready
Backtick literals
const hello = `Hello world!`
ready
Double quotes empty string
const empty = ""
ready
Single quotes empty string
const empty = ''
ready
Backticks empty string
const empty = ``
ready
Empty string comparison
const empty = ""
if(empty === "")
  console.log("Empty string!")
ready
Length comparison
const empty = ""
if(empty.length === 0)
  console.log("Empty string!")
ready
Falsy comparison
const empty = ""
if(empty == false)
  console.log("Empty string!")
ready
Concatenation with +
const world = "World!"
const merged = "Hello " + world
console.log(merged)
ready
Interpolation with `
const world = "World!"
const merged = `Hello ${world}`
console.log(merged)
ready

Revisions

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

  • Revision 1: published by djD-REK on