What's Changed
This is a performance release of protobuf-es. We've made substantial improvements to the runtime, while also reducing bundle size by 5%. Here are the results from our benchmarks (compared against v2.13.0):
| fixture | toBinary | fromBinary | toJson | fromJson |
|---|---|---|---|---|
| general | 4.66x | 1.46x | 2.29x | 1.67x |
| scalar | 2.91x | 1.96x | 1.74x | 1.64x |
| repeated-scalar | 4.37x | 1.53x | 3.06x | 1.65x |
| map-scalar | 4.43x | 1.44x | 2.42x | 2.28x |
| repeated-message | 5.27x | 1.89x | 1.71x | 1.63x |
| map-message | 5.21x | 1.95x | 1.81x | 1.66x |
| user-tiny | 1.44x | 1.99x | 1.49x | 1.50x |
| user-normal | 5.24x | 1.99x | 2.33x | 2.03x |
Individual changes are below:
- Add benchmarks by @ajeetdsouza in #1474
- Optimize BinaryWriter with a growable buffer by @jlucaso1 in #1108
- Use Set to check for WKTs by @ajeetdsouza in #1475
- Cache DataView in BinaryWriter by @ajeetdsouza in #1483
- Use native String.prototype.isWellFormed() when available by @ajeetdsouza in #1479
- Drop support for Node.js 20 by @timostamm in #1488
- Use native toBase64 / fromBase64 when available by @ajeetdsouza in #1477
- Avoid allocations in varint64 by @ajeetdsouza in #1498
- Compile descriptors to closure trees by @ajeetdsouza in #1491
- Reserve bytes for lenPrefix in strings / fork-join by @ajeetdsouza in #1490
- Fix byte size estimate in base64 fallback by @ajeetdsouza in #1504
- Define descriptor toString instead of assigning it by @ltrouton in #1507
- Use setFromBase64 instead of fromBase64 by @ajeetdsouza in #1508
- Compile and cache create() function by @ajeetdsouza in #1499
- Add ASCII fast paths by @ajeetdsouza in #1509
New Contributors
- @anuraaga made their first contribution in #1478
- @jlucaso1 made their first contribution in #1108
- @ltrouton made their first contribution in #1507
Full Changelog: v2.13.0...v2.14.0