Script Preparation code:
AخA
 
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];
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Splitting
    Regex

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 months ago)
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
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Splitting 20250144.0 Ops/sec
Regex 37907584.0 Ops/sec