Skip to content

Commit eff7857

Browse files
committed
update benchmark results
1 parent 60e0121 commit eff7857

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -517,21 +517,20 @@ V8's built-in JSON has been improved for years, esp. `JSON.parse()` is [signific
517517

518518
However, MessagePack can handles binary data effectively, actual performance depends on situations. You'd better take benchmark on your own use-case if performance matters.
519519

520-
Benchmark on NodeJS/v12.18.3 (V8/7.8)
520+
Benchmark on NodeJS/v18.1.0 (V8/10.1)
521521

522522
operation | op | ms | op/s
523523
----------------------------------------------------------------- | ------: | ----: | ------:
524-
buf = Buffer.from(JSON.stringify(obj)); | 840700 | 5000 | 168140
525-
buf = JSON.stringify(obj); | 1249800 | 5000 | 249960
526-
obj = JSON.parse(buf); | 1648000 | 5000 | 329600
527-
buf = require("msgpack-lite").encode(obj); | 603500 | 5000 | 120700
528-
obj = require("msgpack-lite").decode(buf); | 315900 | 5000 | 63180
529-
buf = require("@msgpack/msgpack").encode(obj); | 945400 | 5000 | 189080
530-
obj = require("@msgpack/msgpack").decode(buf); | 770200 | 5000 | 154040
531-
buf = /* @msgpack/msgpack */ encoder.encode(obj); | 1162600 | 5000 | 232520
532-
obj = /* @msgpack/msgpack */ decoder.decode(buf); | 787800 | 5000 | 157560
533-
534-
Note that `Buffer.from()` for `JSON.stringify()` is necessary to emulate I/O where a JavaScript string must be converted into a byte array encoded in UTF-8, whereas MessagePack's `encode()` returns a byte array.
524+
buf = Buffer.from(JSON.stringify(obj)); | 902100 | 5000 | 180420
525+
obj = JSON.parse(buf.toString("utf-8")); | 898700 | 5000 | 179740
526+
buf = require("msgpack-lite").encode(obj); | 411000 | 5000 | 82200
527+
obj = require("msgpack-lite").decode(buf); | 246200 | 5001 | 49230
528+
buf = require("@msgpack/msgpack").encode(obj); | 843300 | 5000 | 168660
529+
obj = require("@msgpack/msgpack").decode(buf); | 489300 | 5000 | 97860
530+
buf = /* @msgpack/msgpack */ encoder.encode(obj); | 1154200 | 5000 | 230840
531+
obj = /* @msgpack/msgpack */ decoder.decode(buf); | 448900 | 5000 | 89780
532+
533+
Note that `JSON` cases use `Buffer` to emulate I/O where a JavaScript string must be converted into a byte array encoded in UTF-8, whereas MessagePack modules deal with byte arrays.
535534

536535
## Distribution
537536

0 commit comments

Comments
 (0)