miller/pkg
John Kerl 2bdb7f62e0 Pool DSL stack frames across records (~8-9% on put)
A StackFrameSet lives on the persistent runtime.State and is reused across
all records, but every block entry (StatementBlockNode.Execute does
PushStackFrame/PopStackFrame, which runs once per record for the main block,
plus once per if/for/etc.) allocated a fresh StackFrame -- a []*var slice and
a map[string]int -- and discarded it on exit. For `put`/`filter` that is
millions of throwaway allocations.

Since push/pop is strictly LIFO, retain popped frames in a per-frameset free
list and clear-and-reuse them on the next push. After the first record
establishes the max block-nesting depth, per-record block execution is
allocation-free for frames. len(stackFrames) remains the logical depth, so
get/set/defineTyped/unset/etc. are unchanged.

Measured (big.csv, 1M rows, best of 4):
  put  chain-1  0.78 -> 0.72  (~8%)
  put  chain-4  0.96 -> 0.87  (~9%)

Allocation objects for put chain-1 drop ~23.1M -> ~20.0M (the per-record
newStackFrame churn, ~2.86M, is eliminated). UDF calls still allocate a fresh
frameset per call (PushStackFrameSet); pooling those is a separate change.

The dominant remaining DSL allocator is FromFloat (~6.8M, interior arithmetic
temporaries); eliminating it needs node-owned result slots + in-place bif
variants, a much larger and aliasing-sensitive change, left for follow-up.

Verified: go test ./pkg/... and full regression suite pass; put output is
byte-identical, including UDFs with locals/loops/blocks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 15:44:49 -04:00
..
auxents Performance and style fixes (#1981) 2026-02-18 09:19:31 -05:00
bifs Fix mlr -s shebang doc and reject arrays/maps in contains/index (#1658) (#2058) 2026-05-17 11:40:39 -04:00
cli Add --omd-aligned flag for column-padded markdown output (#2057) 2026-05-16 11:41:01 -04:00
climain Default to "cat" verb when none is supplied (#2060) 2026-05-17 12:13:21 -04:00
colorizer Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
dkvpx Add DKVPX file format (#2002) 2026-03-02 22:35:08 -05:00
dsl Fix mlr -s shebang doc and reject arrays/maps in contains/index (#1658) (#2058) 2026-05-17 11:40:39 -04:00
entrypoint Improve error propagation (#1975) 2026-02-16 16:48:41 -05:00
go-csv Some fixes for staticcheck (#2006) 2026-03-03 09:27:03 -05:00
input Batch-allocate per-record objects; reuse CSV writer field buffer 2026-06-19 12:27:22 -04:00
lib Fix column alignment for wide and combining Unicode chars (#1520, #379) (#2061) 2026-05-17 12:12:54 -04:00
mlrval Batch-allocate per-record objects; reuse CSV writer field buffer 2026-06-19 12:27:22 -04:00
output Batch-allocate per-record objects; reuse CSV writer field buffer 2026-06-19 12:27:22 -04:00
parsing Replace GOCC parser-generator with PGPG (#2015) 2026-03-15 22:28:57 -04:00
pbnjay-strptime Performance and style fixes (#1981) 2026-02-18 09:19:31 -05:00
platform Performance and style fixes (#1981) 2026-02-18 09:19:31 -05:00
runtime Pool DSL stack frames across records (~8-9% on put) 2026-06-19 15:44:49 -04:00
scan Performance and style fixes (#1981) 2026-02-18 09:19:31 -05:00
stream Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
terminals Default to "cat" verb when none is supplied (#2060) 2026-05-17 12:13:21 -04:00
transformers Apply join prefixes/rename to unpaired records (#1821) (#2062) 2026-05-17 12:35:58 -04:00
types Update performance docs (#1991) 2026-02-22 17:04:35 -05:00
version Post-6.18.1 release: back to 6.18.1-dev 2026-04-19 12:03:05 -04:00
README.md Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00

Please see ../../README-dev.md for an overview; please see each subdirectory for details about it.