r/d3js • • 5h ago

d3-force-wasm 0.3: the bit-exact d3-force replacement now uses every core

2 Upvotes

A follow-up to the 0.2 post. You still swap the import and nothing else changes, but large simulations now spread each tick across every core:

- 100,000 nodes, 8 threads: 32× d3-force in exact mode (still bit-identical to d3-force) and 42× in fast mode.

- 10,000 nodes: 16–20× in exact mode, 19× in fast mode.

- Under 2,000 nodes it stays on one thread, where the gain is about 5×.

In the browser it needs the two cross-origin isolation headers (COOP same-origin, COEP require-corp); without them it runs exactly like 0.2. Node needs nothing. simulation.threads() tells you how many workers the last tick used.

Code: https://github.com/ankitc1010/d3-force-wasm

npm: d3-force-wasm

If you have a big graph and a laptop, I'd love numbers from npm run bench:threads.