String starts with: startsWith vs .slice (v2)

Revision 2 of this benchmark created on


Setup

var PREFIX = '::'; 
var str = PREFIX + 'hello world';

Test runner

Ready to run.

Testing in
TestOps/sec
Startswith
str.startsWith(PREFIX)
ready
.slice()
str.slice(0, PREFIX.length) === PREFIX;
ready

Revisions

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