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
Commit 55bb792
Browse filesBrowse the repository at this point in the historyBrowse files
textparse [PERF]: pool OM2 composite expansion buffers across parsers
The OM 2.0 parser explodes classic histograms and summaries into flat
series through p.pending and p.seriesBuf. Both were allocated per parser
instance and grown to the size of the largest family on the page, and
since the scrape loop builds a new parser per scrape that was a few KiB
of fresh allocations on every scrape of a page with composites, on top of
what OM 1.0 needs for the same page (which just points into the input).
Keep the backing arrays in a sync.Pool: take them on the first composite
line and hand them back when Next() reaches io.EOF, at which point every
pending entry has been served and nothing references them. On parse
errors they are dropped with the parser. The release also detaches the
slices from the parser so a stray Next() after EOF cannot touch pooled
memory.
Signed-off-by: Bartek Plotka <[email protected]>
0 commit comments