PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/alt/alt-nodejs8/root/lib/node_modules/npm/node_modules/jsonparse/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/alt/alt-nodejs8/root/lib/node_modules/npm/node_modules/jsonparse/bench.js

var fs = require('fs'),
    Parser = require('./jsonparse');


var json = fs.readFileSync("samplejson/basic.json");


while (true) {
  var start = Date.now();
  for (var i = 0; i < 1000; i++) {
    JSON.parse(json);
  }
  var first = Date.now() - start;

  start = Date.now();
  var p = new Parser();
  for (var i = 0; i < 1000; i++) {
    p.write(json);
  }
  var second = Date.now() - start;


  console.log("JSON.parse took %s", first);
  console.log("streaming parser took %s", second);
  console.log("streaming is %s times slower", second / first);
}