Skip to content

Commit 39dfc01

Browse files
authored
Merge pull request #42 from SimenB/8.3-bench
Note that uglify is unnecessary on node 8.3.0
2 parents 9bf3415 + d30c707 commit 39dfc01

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

README.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,39 @@ advantages reduces on large payloads.
66

77
Benchmarks:
88

9+
Node 6.11.2:
10+
911
```
10-
JSON.stringify array x 3,343 ops/sec ±1.28% (86 runs sampled)
11-
fast-json-stringify array x 3,031 ops/sec ±1.38% (88 runs sampled)
12-
fast-json-stringify-uglified array x 3,222 ops/sec ±1.12% (87 runs sampled)
13-
JSON.stringify long string x 12,400 ops/sec ±1.25% (88 runs sampled)
14-
fast-json-stringify long string x 12,151 ops/sec ±1.16% (84 runs sampled)
15-
fast-json-stringify-uglified long string x 12,304 ops/sec ±1.00% (87 runs sampled)
16-
JSON.stringify short string x 4,384,078 ops/sec ±1.53% (88 runs sampled)
17-
fast-json-stringify short string x 11,062,569 ops/sec ±1.10% (85 runs sampled)
18-
fast-json-stringify-uglified short string x 10,642,943 ops/sec ±3.01% (86 runs sampled)
19-
JSON.stringify obj x 1,612,312 ops/sec ±1.40% (87 runs sampled)
20-
fast-json-stringify obj x 3,149,885 ops/sec ±1.46% (85 runs sampled)
21-
fast-json-stringify-uglified obj x 3,374,838 ops/sec ±1.35% (87 runs sampled)
12+
JSON.stringify array x 3,944 ops/sec ±1.13% (83 runs sampled)
13+
fast-json-stringify array x 3,638 ops/sec ±2.56% (83 runs sampled)
14+
fast-json-stringify-uglified array x 3,693 ops/sec ±1.75% (82 runs sampled)
15+
JSON.stringify long string x 15,007 ops/sec ±1.13% (90 runs sampled)
16+
fast-json-stringify long string x 14,480 ops/sec ±1.06% (87 runs sampled)
17+
fast-json-stringify-uglified long string x 14,065 ops/sec ±1.22% (87 runs sampled)
18+
JSON.stringify short string x 5,213,486 ops/sec ±1.35% (84 runs sampled)
19+
fast-json-stringify short string x 12,314,153 ops/sec ±1.54% (83 runs sampled)
20+
fast-json-stringify-uglified short string x 11,801,080 ops/sec ±6.65% (83 runs sampled)
21+
JSON.stringify obj x 1,131,672 ops/sec ±16.67% (61 runs sampled)
22+
fast-json-stringify obj x 3,500,095 ops/sec ±5.50% (80 runs sampled)
23+
fast-json-stringify-uglified obj x 4,091,347 ops/sec ±1.33% (89 runs sampled)
2224
```
2325

24-
Benchmarks taken on Node 6.11.0.
26+
Node 8.3.0:
27+
28+
```
29+
JSON.stringify array x 4,025 ops/sec ±0.99% (90 runs sampled)
30+
fast-json-stringify array x 6,463 ops/sec ±0.99% (90 runs sampled)
31+
fast-json-stringify-uglified array x 6,314 ops/sec ±1.15% (92 runs sampled)
32+
JSON.stringify long string x 14,648 ops/sec ±1.64% (88 runs sampled)
33+
fast-json-stringify long string x 14,822 ops/sec ±1.09% (88 runs sampled)
34+
fast-json-stringify-uglified long string x 14,963 ops/sec ±0.86% (89 runs sampled)
35+
JSON.stringify short string x 4,724,477 ops/sec ±1.03% (89 runs sampled)
36+
fast-json-stringify short string x 12,484,378 ops/sec ±0.92% (88 runs sampled)
37+
fast-json-stringify-uglified short string x 12,218,181 ops/sec ±1.24% (90 runs sampled)
38+
JSON.stringify obj x 1,898,648 ops/sec ±2.15% (85 runs sampled)
39+
fast-json-stringify obj x 5,714,557 ops/sec ±1.45% (90 runs sampled)
40+
fast-json-stringify-uglified obj x 5,902,021 ops/sec ±1.06% (91 runs sampled)
41+
```
2542

2643
#### Table of contents:
2744
- <a href="#example">`Example`</a>
@@ -331,6 +348,9 @@ console.log(stringify(obj)) // '{"id":18446744073709551615}'
331348
If you want to squeeze a little bit more performance out of the serialisation, at the cost of readability in the generated code, you can pass `uglify: true` as an option.
332349
Note that you have to manually install `uglify-es` in order for it to work. Only version 3 is supported.
333350
Example:
351+
352+
Note that if you are using Node 8.3.0 or newer, there are no performance gains from using Uglify. See https://www.nearform.com/blog/node-js-is-getting-a-new-v8-with-turbofan/
353+
334354
```javascript
335355

336356
const stringify = fastJson({

0 commit comments

Comments
 (0)