Repository navigation
GoRapide v0.2.4.
Performance fix on the poset query path: the causal-equivalence quotient
introduced in v0.2.0 made causalClassSuccessorsLocked /
causalClassPredecessorsLocked (and the class-introspection helpers) scan the
entire poset on every call, turning every O(V+E) reachability walk —
IsCausallyBefore, IsCausallyIndependent, CausalAncestors /
CausalDescendants, and every pattern.Seq / ImmSeq / Join /
Independent / Within causal check — into O(V²).
A new incremental classMembers index (the inverse of the existing
causalClass map) makes those lookups O(class size x degree) instead of
O(poset size). Observable behavior is unchanged: identical result sets, in
identical canonical EventID order, with identical B/op and allocs/op.
Measured on an Apple M3, -benchtime=200x -count=3:
BenchmarkIsCausallyBeforeDeepChain: ~227-235ms/op -> ~0.89-1.72ms/op
(~130-260x faster)BenchmarkIsCausallyBeforeWithEquivalenceClasses: ~197-213ms/op ->
~0.91-1.51ms/op (~130-220x faster)
Full details, plus the v0.2.1-v0.2.3 performance rounds that preceded this
one, are in CHANGELOG.md.