Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark results compared to JSON to README? #73

Open
brandonros opened this issue Sep 8, 2018 · 3 comments
Open

Add benchmark results compared to JSON to README? #73

brandonros opened this issue Sep 8, 2018 · 3 comments

Comments

@brandonros
Copy link

brandonros commented Sep 8, 2018

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?...

@vnoder
Copy link

vnoder commented Feb 15, 2019

Me too

@thephoenixofthevoid
Copy link
Contributor

JSON methods are native functions heavily micro-optimized by browser vendors/nodejs C++ devs. It's very difficult to come up with something faster written purely in js, but relatively easy --- with something better: extensible, compact and supporting more types out of box.

@nguyenquyhy
Copy link

Really hope there is some maintained benchmark (esp. comparing to JSON) for this project. It is very hard to decide without knowing the circumstances that MessagePack is actually better than JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants