From 193e65c006a8df8e9b72e0f23ace14a94952ee36 Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Tue, 6 Dec 2016 23:25:28 +0100 Subject: [PATCH] Added benchmark and profile related information to README [ci skip] --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5a48a47ab..f0e9f42df 100644 --- a/README.md +++ b/README.md @@ -379,7 +379,7 @@ protobuf.js integrates into any browserify build-process. There are a few possib Performance ----------- -The package includes a [benchmark](https://github.com/dcodeIO/protobuf.js/tree/master/bench) that tries to compare performance to native JSON as far as this is possible. On an i7-2600K running node 6.9.1 it yields: +The package includes a benchmark that tries to compare performance to native JSON as far as this is possible. On an i7-2600K running node 6.9.1 it yields: ``` benchmarking encoding performance ... @@ -413,7 +413,7 @@ JSON to/from buffer x 89,593 ops/sec ±0.85% (87 runs sampled) JSON to/from buffer was 62.4% slower ``` -Note that JSON is a native binding nowadays and as such is *really* fast. So, how can protobuf.js be faster? +Note that JSON is a native binding nowadays and as such is about as fast as it possibly can get. So, how can protobuf.js be faster? * The benchmark is [somewhat flawed](https://github.com/dcodeIO/protobuf.js/blob/master/bench/index.js). * Reader and writer interfaces configure themselves according to the environment to eliminate redundant conditionals. @@ -425,7 +425,19 @@ Note that JSON is a native binding nowadays and as such is *really* fast. So, ho Note that code generation requires `new Function(...)` (basically `eval`) support and that an equivalent but slower fallback will be used where unsupported. -Also note that as of this writing, the benchmark suite performs significantly slower on node 7.2.0 compared to 6.9.1 because moths. +You can also run [the benchmark](https://github.com/dcodeIO/protobuf.js/blob/master/bench/index.js) ... + +``` +$> npm run bench +``` + +and [the profiler](https://github.com/dcodeIO/protobuf.js/blob/master/bench/prof.js) yourself (the latter requires a recent version of node): + +``` +$> npm run prof [iterations=10000000] +``` + +Note that as of this writing, the benchmark suite performs significantly slower on node 7.2.0 compared to 6.9.1 because moths. Compatibility -------------