interledgerjs / btp-packet

Packet parser for Bilateral Transfer Protocol
1 stars 3 forks source link

perf: use oer-utils#dj-alloc-writer #34

Closed sentientwaffle closed 5 years ago

sentientwaffle commented 5 years ago

Depends on https://github.com/interledgerjs/oer-utils/pull/21.

In addition to switching to the new oer-utils, common sub-protocol names are stored as buffers to avoid re-allocating copies every serialize().

Benchmarks (before and after):

serialize:   Message     v0 x 250,978 ops/sec ±0.85% (91 runs sampled)
serialize:   Message     v1 x 862,162 ops/sec ±1.08% (94 runs sampled)
deserialize: Message     v0 x 735,601 ops/sec ±1.88% (94 runs sampled)
deserialize: Message     v1 x 2,605,169 ops/sec ±0.60% (92 runs sampled)