removePrefix alternatives (v2)

Revision 2 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
.slice
let str = 'greninja'
let substr = 'gren'
if (str.startsWith(substr)) {
  str.slice(substr.length - 1)
}
ready
regex
let str = 'greninja'
str.replace(/^gren/, '')
ready

Revisions

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