pbf
flatbush
pbf | flatbush | |
---|---|---|
4 | 5 | |
763 | 1,375 | |
0.9% | - | |
0.0 | 0.0 | |
over 1 year ago | 3 months ago | |
JavaScript | JavaScript | |
BSD 3-clause "New" or "Revised" License | ISC License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
pbf
-
Parquet-WASM: Rust-based WebAssembly bindings to read and write Parquet data
it's been about 3 years, but in Grafana at the time we were using something like ArrowJS + Arrow Flight + protobuf.js and then render the datasets into dashboards on Canvas, especially for streaming at ~20hz.
when i benchmarked the fastest lib to simply convert the protobuf decode (https://github.com/mapbox/pbf), it was 5x slower than native JSON parsing in browsers for dataframe-like structures (e.g. a few dozen 2k-long arrays of floats).
-
Outperform Protobuf.js with fixed-size encoding
does it beat https://github.com/mapbox/pbf ?
-
Protobuf-ES: The Protocol Buffers TypeScript/JavaScript runtime we all deserve
at least in the frontend (without WASM), it depends.
i tested https://github.com/mapbox/pbf and while it was faster for deep/complex structs vs an unoptimized/repetative JSON blob, it was slower at shallow structs and flat arrays of stuff. if you spend a bit of time 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 JIT does not.
-
A standalone protobuf to typescript(for deno) code generator
The runtime is taken from mapbox/pbf (with basic type definitions)
flatbush
-
Databases are the endgame for data-oriented design
> (There are ECS frameworks in JavaScript, which gives you absolutely no control over memory layout and thus completely defeats one of the primary purposes of the pattern.)
While JS does not provide great support for bit packing complex structs, typed arrays give you quite a bit of control over memory layout for simple numeric types, which is what you usually want for optimal data-oriented code anyway. This is a common technique used in fast JS libs for data visualization, ie:
https://github.com/mourner/flatbush
There are also basic operators required for bitarrays, which are useful for ECS and memory-efficient code generally.
-
React Virtualisation from scratch
using flatbush library instead of rbush which optimise the statically placed element, from the benchmark in the repository it could boost up to 5x the performance of rbush.
-
Load GeoHash data in RAM for querying for Proximity Searches
But for 500 k points, it's not many. I'd put it in the database tech I was using and hit an API for it. Or like you say, load it into memory and use Mourner's flatbush for a super simple and super fast solution..
- Flatbush: A fast static spatial index for 2D points and rectangles in JavaScript
-
Protobuf-ES: The Protocol Buffers TypeScript/JavaScript runtime we all deserve
> At pbf speeds, decoding is usually no longer a bottleneck, but bandwidth might be when comparing with gzipped JSON.
we were streaming a few hundred datapoints in a dozen flat arrays over websocket at 20-40hz and needed to decode the payload eagerly. plain JSON was a multi-factor speedup over pbf for this case. but it's fully possible i was holding it wrong, too!
even if your "bottleneck" is rendering/rasterization (10ms), but your data pipe takes 5ms instead of 1ms, it's a real effect on framerate, battery, thermals, etc.
i'm a big fan of your work! while i have you here, would you mind reviewing this sometime soon? ;)
https://github.com/mourner/flatbush/pull/44
What are some alternatives?
protobuf - Protocol Buffers for JavaScript (& TypeScript).
virtualised-whiteboard
sia - Sia - Binary serialisation and deserialisation
liwords - A site that allows people to play a crossword board game against each other
mbtileserver - Basic Go server for mbtiles
protoc-gen-validate - Protocol Buffer Validation - Being replaced by github.com/bufbuild/protovalidate
deno-pbf - Deno pbf port of https://github.com/mapbox/pbf
react-virtualized - React components for efficiently rendering large lists and tabular data
osm - Open Service Mesh (OSM) is a lightweight, extensible, cloud native service mesh that allows users to uniformly manage, secure, and get out-of-the-box observability features for highly dynamic microservice environments.
ts-proto - An idiomatic protobuf generator for TypeScript
fast-encoding - Fast, cross-platform, small and easy-to-use base64 and hex encoding.
rbush - RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles