What does HackerNews think of pbf?

A low-level, lightweight protocol buffers implementation in JavaScript.

Language: JavaScript

#110 in JavaScript
#10 in Library
at least in the frontend (without WASM), it depends.

a few months ago i tested https://github.com/mapbox/pbf and while it was faster for deep/complex structs vs an unoptimized/repetative JSON blob, it was much slower at shallow structs and flat arrays of stuff. if you spend a bit of time to encode stuff as flat arrays to avoid mem alloc, JSON parsing wins by a lot since it goes through highly optimized C or assembly, while decoding protobuf in the JS JIT does not.

of course it's not always feasible to make optimized over-the-wire JSON structs if you have a huge/complex API that can return many shapes of complex structs.

Thank you! I'd also like to list some of the building blocks of GL JS that remain open source and are heavily used in other open source projects:

- GeoJSON-VT (fast GeoJSON processing) https://github.com/mapbox/geojson-vt

- Earcut (triangulating polygons) https://github.com/mapbox/earcut

- Supercluster (point clustering) https://github.com/mapbox/supercluster

- vt-pbf (converting GeoJSON tiles to VT) https://github.com/mapbox/vt-pbf

- vector-tile (decoding vector tiles) https://github.com/mapbox/vector-tile-js

- pbf (fast reading/writing of protobuf) https://github.com/mapbox/pbf

- TinySDF (generating SDF from local CJK fonts) https://github.com/mapbox/tiny-sdf

- Potpack (generating sprite layouts) https://github.com/mapbox/potpack

- grid-index (spatial index for collisions/querying) https://github.com/mapbox/grid-index

- Pixelmatch (image comparison in render tests) https://github.com/mapbox/pixelmatch

- Polylabel (fitting labels into polygons) https://github.com/mapbox/polylabel

Here are some other great tools that is quite useful with protobufs, one in C++ and one in pure javascript.

https://github.com/mapbox/protozero

https://github.com/mapbox/pbf