-
-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
encodedecode_json.js
var msg = { hello: 'world' }
var encode = JSON.stringify
var decode = JSON.parse
var max = 100000
var start
var stop
var i
function run () {
for (i = 0; i < max; i++) {
decode(encode(msg))
}
}
// preheat
run()
start = Date.now()
run()
stop = Date.now()
console.log('time', stop - start)
console.log('decode/s', max / (stop - start) * 1000)
$ node encodedecode_json.js
time 79
decode/s 1265822.7848101268
compared to
$ node encodedecode.js
time 1594
decode/s 62735.25721455458
Am I misunderstanding something?...
Metadata
Metadata
Assignees
Labels
No labels