test vs indexof vs replace

Benchmark created by stefano on


Description

testing split vs test vs indexof

Setup

var url = "http://home.intertwine.com/it/editor/story?challenge=123434",
        search  = "?challenge=12345";

Test runner

Ready to run.

Testing in
TestOps/sec
test
var is_contest = /challenge/.test(url);
ready
indexof
var is_contest = url.indexOf("challenge");
ready
replace
var id_contest = search.replace("?challenge=", ""); 
ready

Revisions

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

  • Revision 1: published by stefano on