substring vs replace vs slice (v2)

Revision 2 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
substring
str = "http://google.com/"
str.endsWith("/") ? str.substring(0, str.length - 1) : str
ready
replace
str = "http://google.com/"
str.endsWith("/") ? str.replace(/\/+$/, "") : str
ready
slice
str = "http://google.com/"
str.endsWith("/") ? str.slice(0, -1) : str
ready

Revisions

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