string.split vs. indexOf (v11)

Revision 11 of this benchmark created on


Preparation HTML

<p id='test' class='one two three'>TEST</p>

Setup

var theEl = document.getElementById("test"),
    theClass = theEl.className;

Test runner

Ready to run.

Testing in
TestOps/sec
string.match
if (theClass.match('two')) { return true; }
ready
string.split
var classes = theClass.split('two');
 
ready
indexOf
if (theClass.indexOf('two') > -1) { return true; }
ready

Revisions

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