Skip to content

v0.2.3

Choose a tag to compare

@ShaneDolphin ShaneDolphin released this 24 Aug 02:03
· 3 commits to main since this release

GoRapide v0.2.3.

Performance fix on the query path: EventsByName (and the observation-view
path it shares with ObservationViews / AddObservationWithTimings) was
rewritten in v0.2.0 to test observation names by cloning and sorting every
observation of every scanned event, matching or not, then building each
returned view through a clone helper that computed a full Params /
Observations copy it immediately discarded and recomputed.

  • A new unexported (*Event).observationsNamed scans stored observations
    directly with no copying or sorting; only actual matches reach eventView.
  • eventView builds the view directly instead of routing through
    cloneEvent, and no longer deep-copies the matched observation's Params
    map twice.
  • Which (event, observation) pairs match, their values, and their sort order
    are unchanged. Pinned by TestEventsByNameContract.

Two disclosed aliasing changes — read these before upgrading if you mutate
returned events:

  • Within one returned view, view.Params and the matched
    view.Observations[i].Params are now the same map object rather than two
    independent copies. Confined to that one returned view; it never reaches the
    poset's stored state or any other view.
  • A legacy (non-deterministic) event matched via its own primary
    Name/Source role now returns the shared, frozen stored *Event pointer
    instead of a cloned view — the same aliasing norm Event() and Events()
    already use. Callers must not mutate such a match. Secondary observation
    roles and all matches on deterministic events are unchanged and still return
    isolated, defensively-copied views.

Measured on an Apple M3, no -race; B/op and allocs/op were exactly
reproducible and are the reliable signal (ns/op was noisy):

  • BenchmarkEventsByName: ~2.50MB/op and 23,261 allocs/op ->
    164,528 B/op and 1,511 allocs/op.
  • BenchmarkEventsByNameLegacyPrimary: 244,528 B/op and 1,761 allocs/op ->
    16,528 B/op and 261 allocs/op (~93% fewer bytes, ~85% fewer allocations).

Full details in CHANGELOG.md.