Skip to content

make Encoder/Decoder instances easily reusable #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 6, 2020
Merged

Conversation

gfx
Copy link
Member

@gfx gfx commented Sep 6, 2020

It changes the interfaces to Encoder and Decoder, so I'll bump the major version on the next release.

Benchmark Results

npx ts-node benchmark/benchmark-from-msgpack-lite.ts
Benchmark on NodeJS/v14.8.0 (V8/8.4)

operation                                                         |   op   |   ms  |  op/s
----------------------------------------------------------------- | ------: | ----: | ------:
buf = Buffer.from(JSON.stringify(obj));                           |  763800 |  5000 |  152760
buf = JSON.stringify(obj);                                        | 1086600 |  5000 |  217320
obj = JSON.parse(buf);                                            | 1634600 |  5000 |  326920
buf = require("msgpack-lite").encode(obj);                        |  462900 |  5000 |   92580
obj = require("msgpack-lite").decode(buf);                        |  271700 |  5001 |   54329
buf = require("@msgpack/msgpack").encode(obj);                    |  802400 |  5000 |  160480
obj = require("@msgpack/msgpack").decode(buf);                    |  724400 |  5000 |  144880
buf = /* @msgpack/msgpack */ encoder.encode(obj);                 | 1083000 |  5000 |  216600
obj = /* @msgpack/msgpack */ decoder.decode(buf);                 |  737500 |  5000 |  147500```
@codecov-commenter
Copy link

codecov-commenter commented Sep 6, 2020

Codecov Report

Merging #121 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #121      +/-   ##
==========================================
+ Coverage   98.46%   98.49%   +0.02%     
==========================================
  Files          15       15              
  Lines         914      929      +15     
  Branches      196      198       +2     
==========================================
+ Hits          900      915      +15     
  Misses         14       14              
Impacted Files Coverage Δ
src/CachedKeyDecoder.ts 100.00% <100.00%> (ø)
src/Decoder.ts 99.14% <100.00%> (+0.01%) ⬆️
src/Encoder.ts 97.97% <100.00%> (+0.05%) ⬆️
src/decode.ts 100.00% <100.00%> (ø)
src/decodeAsync.ts 100.00% <100.00%> (ø)
src/encode.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a1ecc9...8ca191c. Read the comment docs.

@gfx gfx merged commit 1dfecda into master Sep 6, 2020
@gfx gfx deleted the reuse_instances branch September 6, 2020 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants