split/substring vs regex to parse integer from string (v8)

Revision 8 of this benchmark created on


Preparation HTML

<script>
</script>

Setup

var str = 'col15 row16';

Test runner

Ready to run.

Testing in
TestOps/sec
split/parse
var split = str.split(' ');
var col = parseInt(split[0].substr(3));
var row = parseInt(split[1].substr(3));
ready
regex get
var arr = str.match(/\d+/g)
var col = parseInt(arr[0]);
var row = parseInt(arr[1]);
ready

Revisions

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