Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Split vs Regex json strings
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Splitting
20250144.0 Ops/sec
Regex
37907584.0 Ops/sec
Script Preparation code:
var testString = '{ "type": "Feature", "properties": { "OBJECTID": 1, "OBJECTID_12": 1, "ELEV_IN_FT": 5397, "DATE_CREATED": "318816000000", "DATE_EDITED": "", "name": "Agua Sal Creek", "type": "Stream", "source": "USGS_PlaceNamesUSA", "description": "", "state": "Arizona", "class": "Place Name", "map_layer": "Place Name", "state_ab": "AZ", "lat": 36.461112200202791, "long": -109.47843940044683, "gmu_id": "", "hasname": "" }, "geometry": { "type": "Point", "coordinates": [ -109.478439400446817, 36.461112200202805, 0.0 ] } },\n{ "type": "Feature", "properties": { "OBJECTID": 1, "OBJECTID_12": 1, "ELEV_IN_FT": 5397, "DATE_CREATED": "318816000000", "DATE_EDITED": "", "name": "Agua Sal Creek", "type": "Stream", "source": "USGS_PlaceNamesUSA", "description": "", "state": "Arizona", "class": "Place Name", "map_layer": "Place Name", "state_ab": "AZ", "lat": 36.461112200202791, "long": -109.47843940044683, "gmu_id": "", "hasname": "" }, "geometry": { "type": "Point", "coordinates": [ -109.478439400446817, 36.461112200202805, 0.0 ] } },\n{ "type": "Feature", "properties": { "OBJECTID": 1, "OBJECTID_12": 1, "ELEV_IN_FT": 5397, "DATE_CREATED": "318816000000", "DATE_EDITED": "", "name": "Agua Sal Creek", "type": "Stream", "source": "USGS_PlaceNamesUSA", "description": "", "state": "Arizona", "class": "Place Name", "map_layer": "Place Name", "state_ab": "AZ", "lat": 36.461112200202791, "long": -109.47843940044683, "gmu_id": "", "hasname": "" }, "geometry": { "type": "Point", "coordinates": [ -109.478439400446817, 36.461112200202805, 0.0 ] } },\n{ "type": "Feature", "properties": { "OBJECTID": 1, "OBJECTID_12": 1, "ELEV_IN_FT": 5397, "DATE_CREATED": "318816000000", "DATE_EDITED": "", "name": "Agua Sal Creek", "type": "Stream", "source": "USGS_PlaceNamesUSA", "description": "", "state": "Arizona", "class": "Place Name", "map_layer": "Place Name", "state_ab": "AZ", "lat": 36.461112200202791, "long": -109.47843940044683, "gmu_id": "", "hasname": "" }, "geometry": { "type": "Point", "coordinates": [ -109.478439400446817, 36.461112200202805, 0.0 ] } },\n'
Tests:
Splitting
var values = testString.split("\n"); var value1 = values[0]; var value2 = values[1]; var value3 = values[2];
Regex
var regex = /.+((?=\n)|$)/g var value1 = regex[0]; var value2 = regex[1]; var value3 = regex[2];