Created
July 13, 2017 22:05
-
-
Save Jonathancollinet/26d6e2bad49f204f10fe85ec18f28e2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const msgpack = require('msgpack'), | |
os = require('os'); | |
for(let r = 1; r < 4; r++) { | |
console.log("\nRun #" + r + ":"); | |
const obj = {'abcdef' : 1, 'qqq' : 13, '19' : [1, 2, 3, 4]}; | |
let start = Date.now(); | |
for(let i = 0; i < 500000; i++) { | |
JSON.parse(JSON.stringify(obj)); | |
} | |
let stop = Date.now(); | |
console.log("\t JSON: " + (stop - start) + "ms"); | |
start = Date.now(); | |
for(let i = 0; i < 500000; i++) { | |
msgpack.unpack(msgpack.pack(obj)); | |
} | |
stop = Date.now(); | |
console.log("\tMsgPack: " + (stop - start) + "ms"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment