simple split vs regex (v3)

Revision 3 of this benchmark created on


Setup

var hrefs = [
      'http://example.com/subsite/keYword/keyVALUe1',
      'http://example.com/subsite/keywoRd/keyvalue2/',
      'http://example.com/subsite/keyword/kEYVvalue3/more',
      'http://example.com/subsite/nokeyword/nokeyvalue/more',
      'http://example.com/subsite/keyword/',
      'http://example.com/subsite/keyword',
      'http://example.com/subsite/more'
    ].join('#'), token = 'subsite',
    reg = new RegExp(token, "i");

Test runner

Ready to run.

Testing in
TestOps/sec
split test
var a = hrefs.split(token);
 
ready
regex test
var a = reg.exec(hrefs);
 
ready

Revisions

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

  • Revision 1: published by DaveInOhio on
  • Revision 2: published by DaveInOhio on
  • Revision 3: published on