msgpackr 1.6.1 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SECURITY.md CHANGED
@@ -1,11 +1,11 @@
1
- # Security Policy
2
-
3
- ## Supported Versions
4
-
5
- | Version | Supported |
6
- | ------- | ------------------ |
7
- | 1.4.x | :white_check_mark: |
8
-
9
- ## Reporting a Vulnerability
10
-
11
- Please report security vulnerabilities to kriszyp@gmail.com.
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | ------------------ |
7
+ | 1.4.x | :white_check_mark: |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ Please report security vulnerabilities to kriszyp@gmail.com.
package/benchmark.md CHANGED
@@ -1,67 +1,67 @@
1
- Here are more comprehensive benchmarks. This is comparison with the next fastest JS projects using the benchmark tool from `msgpack-lite` (and data is from some clinical research data we use that has a good mix of different value types and structures). It also includes comparison to V8 native JSON functionality, and JavaScript Avro (`avsc`, a very optimized Avro implementation):
2
-
3
- operation | op | ms | op/s
4
- ---------------------------------------------------------- | ------: | ----: | -----:
5
- buf = Buffer(JSON.stringify(obj)); | 82000 | 5004 | 16386
6
- obj = JSON.parse(buf); | 88600 | 5000 | 17720
7
- require("msgpackr").pack(obj); | 161500 | 5002 | 32287
8
- require("msgpackr").unpack(buf); | 94600 | 5004 | 18904
9
- msgpackr w/ shared structures: packr.pack(obj); | 178400 | 5002 | 35665
10
- msgpackr w/ shared structures: packr.unpack(buf); | 376700 | 5000 | 75340
11
- buf = require("msgpack-lite").encode(obj); | 30100 | 5012 | 6005
12
- obj = require("msgpack-lite").decode(buf); | 16200 | 5001 | 3239
13
- buf = require("notepack").encode(obj); | 62600 | 5005 | 12507
14
- obj = require("notepack").decode(buf); | 32400 | 5007 | 6470
15
- require("what-the-pack")... encoder.encode(obj); | 63500 | 5002 | 12694
16
- require("what-the-pack")... encoder.decode(buf); | 32000 | 5001 | 6398
17
- require("avsc")...make schema/type...type.toBuffer(obj); | 84600 | 5003 | 16909
18
- require("avsc")...make schema/type...type.toBuffer(obj); | 99300 | 5001 | 19856
19
-
20
- (`avsc` is schema-based and more comparable in style to msgpackr with shared structures).
21
-
22
- Here is a benchmark of streaming data (again borrowed from `msgpack-lite`'s benchmarking), where msgpackr is able to take advantage of the structured record extension and really pull away from other tools:
23
-
24
- operation (1000000 x 2) | op | ms | op/s
25
- ------------------------------------------------ | ------: | ----: | -----:
26
- new PackrStream().write(obj); | 1000000 | 372 | 2688172
27
- new UnpackrStream().write(buf); | 1000000 | 247 | 4048582
28
- stream.write(msgpack.encode(obj)); | 1000000 | 2898 | 345065
29
- stream.write(msgpack.decode(buf)); | 1000000 | 1969 | 507872
30
- stream.write(notepack.encode(obj)); | 1000000 | 901 | 1109877
31
- stream.write(notepack.decode(buf)); | 1000000 | 1012 | 988142
32
- msgpack.Encoder().on("data",ondata).encode(obj); | 1000000 | 1763 | 567214
33
- msgpack.createDecodeStream().write(buf); | 1000000 | 2222 | 450045
34
- msgpack.createEncodeStream().write(obj); | 1000000 | 1577 | 634115
35
- msgpack.Decoder().on("data",ondata).decode(buf); | 1000000 | 2246 | 445235
36
-
37
-
38
-
39
- These are the benchmarks from notepack package. The larger test data for these benchmarks is very heavily weighted with large binary/buffer data and objects with extreme numbers of keys (much more than I typically see with real-world data, but YMMV):
40
-
41
- node ./benchmarks/encode
42
-
43
- library | tiny | small | medium | large
44
- ---------------- | ----------------: | --------------: | ---------------| -------:
45
- notepack | 2,171,621 ops/sec | 546,905 ops/sec | 29,578 ops/sec | 265 ops/sec
46
- msgpack-js | 967,682 ops/sec | 184,455 ops/sec | 20,556 ops/sec | 259 ops/sec
47
- msgpackr | 2,392,826 ops/sec | 556,915 ops/sec | 70,573 ops/sec | 313 ops/sec
48
- msgpack-lite | 553,143 ops/sec | 132,318 ops/sec | 11,816 ops/sec | 186 ops/sec
49
- @msgpack/msgpack | 2,157,655 ops/sec | 573,236 ops/sec | 25,864 ops/sec | 90.26 ops/sec
50
-
51
-
52
- node ./benchmarks/decode
53
-
54
- library | tiny | small | medium | large
55
- ---------------- | ----------------: | --------------: | --------------- | -------:
56
- notepack | 2,220,904 ops/sec | 560,630 ops/sec | 28,177 ops/sec | 275 ops/sec
57
- msgpack-js | 965,719 ops/sec | 222,047 ops/sec | 21,431 ops/sec | 257 ops/sec
58
- msgpackr | 2,320,046 ops/sec | 589,167 ops/sec | 70,299 ops/sec | 329 ops/sec
59
- msgpackr records | 3,750,547 ops/sec | 912,419 ops/sec | 136,853 ops/sec | 733 ops/sec
60
- msgpack-lite | 569,222 ops/sec | 129,008 ops/sec | 12,424 ops/sec | 180 ops/sec
61
- @msgpack/msgpack | 2,089,697 ops/sec | 557,507 ops/sec | 20,256 ops/sec | 85.03 ops/sec
62
-
63
- This was run by adding the msgpackr to the benchmarks for notepack.
64
-
65
- All benchmarks were performed on Node 14.8.0 (Windows i7-4770 3.4Ghz). They can be run with:
66
- npm install --no-save msgpack msgpack-js @msgpack/msgpack msgpack-lite notepack avsc
67
- node tests/benchmark
1
+ Here are more comprehensive benchmarks. This is comparison with the next fastest JS projects using the benchmark tool from `msgpack-lite` (and data is from some clinical research data we use that has a good mix of different value types and structures). It also includes comparison to V8 native JSON functionality, and JavaScript Avro (`avsc`, a very optimized Avro implementation):
2
+
3
+ operation | op | ms | op/s
4
+ ---------------------------------------------------------- | ------: | ----: | -----:
5
+ buf = Buffer(JSON.stringify(obj)); | 82000 | 5004 | 16386
6
+ obj = JSON.parse(buf); | 88600 | 5000 | 17720
7
+ require("msgpackr").pack(obj); | 161500 | 5002 | 32287
8
+ require("msgpackr").unpack(buf); | 94600 | 5004 | 18904
9
+ msgpackr w/ shared structures: packr.pack(obj); | 178400 | 5002 | 35665
10
+ msgpackr w/ shared structures: packr.unpack(buf); | 376700 | 5000 | 75340
11
+ buf = require("msgpack-lite").encode(obj); | 30100 | 5012 | 6005
12
+ obj = require("msgpack-lite").decode(buf); | 16200 | 5001 | 3239
13
+ buf = require("notepack").encode(obj); | 62600 | 5005 | 12507
14
+ obj = require("notepack").decode(buf); | 32400 | 5007 | 6470
15
+ require("what-the-pack")... encoder.encode(obj); | 63500 | 5002 | 12694
16
+ require("what-the-pack")... encoder.decode(buf); | 32000 | 5001 | 6398
17
+ require("avsc")...make schema/type...type.toBuffer(obj); | 84600 | 5003 | 16909
18
+ require("avsc")...make schema/type...type.toBuffer(obj); | 99300 | 5001 | 19856
19
+
20
+ (`avsc` is schema-based and more comparable in style to msgpackr with shared structures).
21
+
22
+ Here is a benchmark of streaming data (again borrowed from `msgpack-lite`'s benchmarking), where msgpackr is able to take advantage of the structured record extension and really pull away from other tools:
23
+
24
+ operation (1000000 x 2) | op | ms | op/s
25
+ ------------------------------------------------ | ------: | ----: | -----:
26
+ new PackrStream().write(obj); | 1000000 | 372 | 2688172
27
+ new UnpackrStream().write(buf); | 1000000 | 247 | 4048582
28
+ stream.write(msgpack.encode(obj)); | 1000000 | 2898 | 345065
29
+ stream.write(msgpack.decode(buf)); | 1000000 | 1969 | 507872
30
+ stream.write(notepack.encode(obj)); | 1000000 | 901 | 1109877
31
+ stream.write(notepack.decode(buf)); | 1000000 | 1012 | 988142
32
+ msgpack.Encoder().on("data",ondata).encode(obj); | 1000000 | 1763 | 567214
33
+ msgpack.createDecodeStream().write(buf); | 1000000 | 2222 | 450045
34
+ msgpack.createEncodeStream().write(obj); | 1000000 | 1577 | 634115
35
+ msgpack.Decoder().on("data",ondata).decode(buf); | 1000000 | 2246 | 445235
36
+
37
+
38
+
39
+ These are the benchmarks from notepack package. The larger test data for these benchmarks is very heavily weighted with large binary/buffer data and objects with extreme numbers of keys (much more than I typically see with real-world data, but YMMV):
40
+
41
+ node ./benchmarks/encode
42
+
43
+ library | tiny | small | medium | large
44
+ ---------------- | ----------------: | --------------: | ---------------| -------:
45
+ notepack | 2,171,621 ops/sec | 546,905 ops/sec | 29,578 ops/sec | 265 ops/sec
46
+ msgpack-js | 967,682 ops/sec | 184,455 ops/sec | 20,556 ops/sec | 259 ops/sec
47
+ msgpackr | 2,392,826 ops/sec | 556,915 ops/sec | 70,573 ops/sec | 313 ops/sec
48
+ msgpack-lite | 553,143 ops/sec | 132,318 ops/sec | 11,816 ops/sec | 186 ops/sec
49
+ @msgpack/msgpack | 2,157,655 ops/sec | 573,236 ops/sec | 25,864 ops/sec | 90.26 ops/sec
50
+
51
+
52
+ node ./benchmarks/decode
53
+
54
+ library | tiny | small | medium | large
55
+ ---------------- | ----------------: | --------------: | --------------- | -------:
56
+ notepack | 2,220,904 ops/sec | 560,630 ops/sec | 28,177 ops/sec | 275 ops/sec
57
+ msgpack-js | 965,719 ops/sec | 222,047 ops/sec | 21,431 ops/sec | 257 ops/sec
58
+ msgpackr | 2,320,046 ops/sec | 589,167 ops/sec | 70,299 ops/sec | 329 ops/sec
59
+ msgpackr records | 3,750,547 ops/sec | 912,419 ops/sec | 136,853 ops/sec | 733 ops/sec
60
+ msgpack-lite | 569,222 ops/sec | 129,008 ops/sec | 12,424 ops/sec | 180 ops/sec
61
+ @msgpack/msgpack | 2,089,697 ops/sec | 557,507 ops/sec | 20,256 ops/sec | 85.03 ops/sec
62
+
63
+ This was run by adding the msgpackr to the benchmarks for notepack.
64
+
65
+ All benchmarks were performed on Node 14.8.0 (Windows i7-4770 3.4Ghz). They can be run with:
66
+ npm install --no-save msgpack msgpack-js @msgpack/msgpack msgpack-lite notepack avsc
67
+ node tests/benchmark