Skip to content

Commit 3405ae8

Browse files
committed
Other: Touched benchmark output metrics once more
1 parent e36b228 commit 3405ae8

File tree

2 files changed

+32
-33
lines changed

2 files changed

+32
-33
lines changed

README.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Because JavaScript is a dynamically typed language, protobuf.js introduces the c
110110

111111
### Valid message
112112

113-
> A valid message is an object a) not missing any required fields and b) exclusively composed of JS types understood by the wire format writer.
113+
> A valid message is an object (1) not missing any required fields and (2) exclusively composed of JS types understood by the wire format writer.
114114
115115
There are two possible types of valid messages and the encoder is able to work with both of these for convenience:
116116

@@ -700,45 +700,45 @@ The package includes a benchmark that compares protobuf.js performance to native
700700
```
701701
benchmarking encoding performance ...
702702
703-
protobuf.js (reflect) x 540,622 ops/sec ±0.87% (89 runs sampled)
704-
protobuf.js (static) x 537,928 ops/sec ±1.19% (91 runs sampled)
705-
JSON (string) x 317,124 ops/sec ±0.63% (91 runs sampled)
706-
JSON (buffer) x 185,945 ops/sec ±0.72% (89 runs sampled)
707-
google-protobuf x 76,552 ops/sec ±0.85% (91 runs sampled)
703+
protobuf.js (reflect) x 541,707 ops/sec ±1.13% (87 runs sampled)
704+
protobuf.js (static) x 548,134 ops/sec ±1.38% (89 runs sampled)
705+
JSON (string) x 318,076 ops/sec ±0.63% (93 runs sampled)
706+
JSON (buffer) x 179,165 ops/sec ±2.26% (91 runs sampled)
707+
google-protobuf x 74,406 ops/sec ±0.85% (86 runs sampled)
708708
709-
protobuf.js (reflect) was fastest
710-
protobuf.js (static) was 0.01 times slower (-0.8% ops/sec)
711-
JSON (string) was 0.70 times slower (-41.2% ops/sec)
712-
JSON (buffer) was 1.90 times slower (-65.6% ops/sec)
713-
google-protobuf was 6.06 times slower (-85.8% ops/sec)
709+
protobuf.js (static) was fastest
710+
protobuf.js (reflect) was 0.9% ops/sec slower (factor 1.0)
711+
JSON (string) was 41.5% ops/sec slower (factor 1.7)
712+
JSON (buffer) was 67.6% ops/sec slower (factor 3.1)
713+
google-protobuf was 86.4% ops/sec slower (factor 7.3)
714714
715715
benchmarking decoding performance ...
716716
717-
protobuf.js (reflect) x 1,386,221 ops/sec ±0.95% (93 runs sampled)
718-
protobuf.js (static) x 1,397,599 ops/sec ±0.74% (91 runs sampled)
719-
JSON (string) x 300,667 ops/sec ±0.88% (90 runs sampled)
720-
JSON (buffer) x 265,276 ops/sec ±0.88% (90 runs sampled)
721-
google-protobuf x 162,202 ops/sec ±0.85% (92 runs sampled)
717+
protobuf.js (reflect) x 1,383,981 ops/sec ±0.88% (93 runs sampled)
718+
protobuf.js (static) x 1,378,925 ops/sec ±0.81% (93 runs sampled)
719+
JSON (string) x 302,444 ops/sec ±0.81% (93 runs sampled)
720+
JSON (buffer) x 264,882 ops/sec ±0.81% (93 runs sampled)
721+
google-protobuf x 179,180 ops/sec ±0.64% (94 runs sampled)
722722
723-
protobuf.js (static) was fastest
724-
protobuf.js (reflect) was 0.01 times slower (-1.0% ops/sec)
725-
JSON (string) was 3.65 times slower (-78.5% ops/sec)
726-
JSON (buffer) was 4.28 times slower (-81.0% ops/sec)
727-
google-protobuf was 7.63 times slower (-88.4% ops/sec)
723+
protobuf.js (reflect) was fastest
724+
protobuf.js (static) was 0.3% ops/sec slower (factor 1.0)
725+
JSON (string) was 78.1% ops/sec slower (factor 4.6)
726+
JSON (buffer) was 80.8% ops/sec slower (factor 5.2)
727+
google-protobuf was 87.0% ops/sec slower (factor 7.7)
728728
729729
benchmarking combined performance ...
730730
731-
protobuf.js (reflect) x 277,238 ops/sec ±0.95% (92 runs sampled)
732-
protobuf.js (static) x 281,732 ops/sec ±0.91% (91 runs sampled)
733-
JSON (string) x 128,615 ops/sec ±1.01% (88 runs sampled)
734-
JSON (buffer) x 89,794 ops/sec ±1.28% (88 runs sampled)
735-
google-protobuf x 40,987 ops/sec ±1.29% (90 runs sampled)
731+
protobuf.js (reflect) x 275,900 ops/sec ±0.78% (90 runs sampled)
732+
protobuf.js (static) x 290,096 ops/sec ±0.96% (90 runs sampled)
733+
JSON (string) x 129,381 ops/sec ±0.77% (90 runs sampled)
734+
JSON (buffer) x 91,051 ops/sec ±0.94% (90 runs sampled)
735+
google-protobuf x 42,050 ops/sec ±0.85% (91 runs sampled)
736736
737737
protobuf.js (static) was fastest
738-
protobuf.js (reflect) was 0.02 times slower (-1.6% ops/sec)
739-
JSON (string) was 1.19 times slower (-54.4% ops/sec)
740-
JSON (buffer) was 2.15 times slower (-68.2% ops/sec)
741-
google-protobuf was 5.90 times slower (-85.5% ops/sec)
738+
protobuf.js (reflect) was 4.7% ops/sec slower (factor 1.0)
739+
JSON (string) was 55.3% ops/sec slower (factor 2.2)
740+
JSON (buffer) was 68.6% ops/sec slower (factor 3.2)
741+
google-protobuf was 85.5% ops/sec slower (factor 6.9)
742742
```
743743

744744
You can also run [the benchmark](https://github.com/dcodeIO/protobuf.js/blob/master/bench/index.js) ...

bench/suite.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ function newSuite(name) {
2626
process.stdout.write("\n" + chalk.white(pad(fastest.name, padSize)) + " was " + chalk.green("fastest") + "\n");
2727
benches.slice(1).forEach(function(bench) {
2828
var hz = getHz(bench);
29-
var percent = (1 - hz / fastestHz); // less total operations per time
30-
var factor = -(1 - fastestHz / hz); // additional time it takes to complete the same number of operations
31-
process.stdout.write(chalk.white(pad(bench.name, padSize)) + " was " + chalk.red(factor.toFixed(2) + " times slower (-" + (percent * 100).toFixed(1) + "% ops/sec)") + "\n");
29+
var percent = (1 - hz / fastestHz);
30+
process.stdout.write(chalk.white(pad(bench.name, padSize)) + " was " + chalk.red((percent * 100).toFixed(1) + "% ops/sec slower (factor " + (fastestHz / hz).toFixed(1) + ")") + "\n");
3231
});
3332
}
3433
process.stdout.write("\n");

0 commit comments

Comments
 (0)