Script Preparation code:
AخA
 
var json = JSON.stringify({
  "type": "l2update",
  "product_id": "BTC-USD",
  "time": "2019-08-14T20:42:27.265Z",
  "changes": [
    [
      "buy",
      "10101.80000000",
      "0.162567"
    ]
  ]
});
Tests:
  • JSON.parse

    x
     
    var o = JSON.parse(json);
    if (o.type === 'l2update') {
      // do something cool
    }
  • String.indexOf

     
    if (json.indexOf('l2update') !== -1) {
      // do something cool
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    JSON.parse
    String.indexOf

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 8 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Chrome 127 on Windows
View result in a separate tab
Test name Executions per second
JSON.parse 997291.6 Ops/sec
String.indexOf 12262335.0 Ops/sec