You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HermitCrab feature structures: reuse traversal state in ValueEquals and Freeze (pooled per-thread sets, no isolated measurement) #589
FeatureStruct.ValueEquals and Freeze allocate visited sets and dictionaries on every call. The change allocates them only once a recursive value is reached. Top-level calls borrow pre-sized collections from a [ThreadStatic] pool and clear them in finally. An InUse guard makes reentrant calls use fresh collections. This is a pool of scratch collections, not a cache of results, and it holds only a few collections per thread. The change is on the archived branch perf/hc-optimization-archive.
Measured. The heaviest Sena profile put feature-structure equality and freezing at 13.7% of wall time, with HashSet resizing a major allocation source. After the change, ValueEqualsImpl and those resizes left the top of the profile. It was not timed in isolation, so no speedup is claimed.
What a revival must do first. Measure it alone, in allocations avoided. Check that the pool size stays bounded per thread. Keep FeatureStructPooledVisitedSetsTests (reuse, clearing after success and failure, reentrancy).
Activity