High-performance SGP4 with WebAssembly (WASM)
developSatellite.js provides a WebAssembly (WASM) implementation of SGP4/SDP4 designed for high-performance, real-time applications. Unlike the pure JavaScript implementation which relies on object allocation and garbage collection, the WASM version uses a C++ backend optimized for minimal overhead.
Key performance characteristics include:
- Zero-copy data access: Results are returned as
TypedArrayviews (e.g.,Float64Array) directly on the WASM linear memory, avoiding expensive serialization/marshalling. - Minimal allocation: Uses a
BulkPropagatorpattern that allocates memory once and reuses it across multiple runs. - SIMD acceleration: Compiled with 128-bit SIMD instructions to allow parallel processing of mathematical operations.
- Single boundary crossing: Entire calculation pipelines (from propagation to look angles) can be executed in a single call to the WASM module, preventing costly JS-WASM context switching.
const now = new Date();
const results = entireSatelliteDatabase
.map(satRec => propagate(satRec, now));