Dynamic Tree Improvements
Box2D's dynamic tree inserts a new proxy using a greedy, single-descent heuristic that approximates minimizing the surface area heuristic (SAH) instead of doing an exhaustive search, since incremental insertion is inherently greedy anyway. At each internal node it compares the direct cost of making the current node the sibling (area of the union) plus an inherited cost accumulated from enlarging ancestors. It also computes an optimistic lower-bound cost for descending into each child. For internal children, that bound is inheritedCost + Area(Union(C, D)) + min(0, Area(D) - Area(C)), clamped so the child itself can still be chosen as the sibling.
Related posts
- Inscribed Spheres
Box2D hardMasterInscribed spheres give a cheap upper bound on the separation achievable along any axis in the separating axis test (SAT): n·d − (rA + rB), where d joins the sphere centers. That one dot product can rule out a polytope face before the O(N) support search. Box3D extends this to edges by projecting d onto each edge's Gauss map arc, using a branchless closed-form test to drop whole edges before the edge-pair stage. On 32-vertex hulls this culls 86% of face tests and 98% of edge pairs, cutting the Convex Pile narrow-phase time by 62%, and SAT becomes roughly competitive with GJK except on long, skinny shapes.
- Box2D 3.2
Box2D easyNoviceBox2D 3.2 runs roughly three times faster than 3.1, with the speedup broken down by source: contact recycling (~40%), solver algorithm refinement (~20%), AVX2 runtime dispatch (~15%), solver optimization (~10%) and broad-phase optimization (~10%), which compound multiplicatively. Following Jolt, body positions now use double precision while heavy math stays single-precision, raising the usable world size from about 16km to 1000km with little performance or memory cost. The release also adds recording and replay for debugging, which lays groundwork for snapshot/restore features such as rewind and networking, plus a new dynamic character mover.
- SIMD for Collision
Box2D hardMasterBox3D uses wide SIMD to speed up the edge-edge phase of the Separating Axis Test, testing one edge of hull A against four edges of hull B at once using structure-of-arrays data. For 32-point convex hulls with 89 edges (7921 edge-edge pairs), SSE2 makes the whole simulation more than twice as fast as scalar code in a 5120-hull pile benchmark, and simply compiling with AVX2 enabled adds roughly another 10%. SAT is preferred over GJK/EPA because it needs no collision margin and avoids EPA's numerical brittleness. Its quadratic cost is bounded by Box3D's 128-edge hull limit, and the optimization does almost nothing for box-box collisions.
- Astra Dynamic Chunks: How We Saved by Redesigning a Key Part of Astra
Slack Engineering mediumAdeptSlack's Astra log search engine replaced fixed-size chunk slots on cache nodes with dynamically sized chunks, because undersized chunks wasted allocated disk space and oversized chunks from recovery tasks could overflow their slots. Cache nodes now advertise disk capacity, and the manager persists chunk-to-node assignments and node metadata in ZooKeeper, using first-fit bin packing to place chunks onto as few nodes as possible. The rollout ran behind a feature flag on one of two data replicas, moving from small clusters to large ones. It cut cache nodes by up to 50% on clusters with many undersized chunks and reduced overall cache node cost by 20%.
- Rope & SumTree
Zed mediumAdeptZed represents buffer text with a rope rather than a string, because contiguous strings make mid-file inserts and deletes, line navigation and very large files expensive. Its rope is not a classic binary-tree rope but a SumTree of fixed-capacity inline Chunks of at most 128 characters in release builds. The leaves are reference-counted via Arc, so edits mostly rewire pointers and snapshots are cheap. Concurrent access was the deciding requirement: every edit can hand a snapshot to a background thread for Tree-sitter re-parsing without copying the text, which made the rope win over gap buffers and piece tables.