Replace vs substr

Benchmark created on


Setup

const GROUP_SUFFIX = "@360learning.com"
const groupSuffixLength = "@360learning.com".length;

Test runner

Ready to run.

Testing in
TestOps/sec
With replace
"group@360learning.com".replace(GROUP_SUFFIX, "");
ready
With substring
"group@360learning.com".slice(0, -groupSuffixLength);
ready

Revisions

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