Releases: mapbox/pbf
Releases · mapbox/pbf
v5.1.0
v5.0.0
Breaking changes
- The
Pbfclass is split into separatePbfReaderandPbfWriterclasses, so bundlers can tree-shake the half you don't use. - Removed the legacy
readVarint64method — usereadVarint(true)for signed 64-bit reads.
Performance
On the Mapbox vector-tile benchmark (439 tiles, 37.5 MB), v5 is ~25% faster to decode and ~27% faster to encode than v4. Highlights:
- Generated reader code was rewritten from a callback-based style into inlined
whileloops with direct field-number dispatch, letting V8 fully inline each reader (biggest decode win). writeVarint/readVarintgot single-byte fast paths for the common case (tags, small ints).- Buffer growth in
makeRoomForExtraLengthnow usesUint8Array.copyWithininstead of a manual byte-shift loop (biggest encode win). writeBytesusestypedArray.setinstead of a manual copy loop.
Other improvements
- The schema compiler (
compile.js) was significantly simplified — generated code is cleaner and easier to read. - Fixed a bug in compiled
packed sfixed64fields.
v4.0.2
v4.0.1
v4.0.0
⚠️ Expose the library as a ES module, dropping CommonJS support.⚠️ Rewrite the codebase to use modern ES syntax (you can still transpile on your end to keep IE11 support).⚠️ Make code generation generate ESM modules by default, with CommonJS available through--legacymode.⚠️ Overhaul code generation to write simpler code that's more compact and more susceptible to efficient minimization — instead of nested objects, the generated code has flat exports of read and write functions (see readme and test fixtures).- Add TypeScript type check & first-class typings via JSDoc comments.
- Remove dependency on
ieee754package and use nativeDataViewinstead, which is faster and universally supported. - Modernize dev tools (use Rollup instead of Browserify for UMD builds, ESLint 9+; in addition to an earlier switch from Tap to native Node test runner and coverage and to GitHub Actions from Travis).
- Fix writing of default oneof fields. #103 by @farwayer