Tests: a record read whole or as an operand still points back at itself, and Record under concurrent use

This commit is contained in:
2026-09-04 09:46:39 +02:00
parent 79827a66d6
commit b99526aeb8
3 changed files with 18 additions and 8 deletions
+4 -2
View File
@@ -52,8 +52,7 @@ func TestNoRenderAllocRegression(t *testing.T) {
}
// A record's fences read the compiled tree, so they belong to New, not to a draw.
// A per-draw walk costs allocations in proportion to the tree; this pins that the
// count does not move with the column count.
// A per-draw walk costs allocations in proportion to the tree.
func TestNoRecordAllocRegression(t *testing.T) {
for _, s := range []struct{ name, json string }{
{"record 3 columns", `{"format":"","a":"x","b":"y","c":"z"}`},
@@ -63,6 +62,9 @@ func TestNoRecordAllocRegression(t *testing.T) {
if err != nil {
t.Fatalf("New(%s): %v", s.name, err)
}
if _, err := f.Record("x"); err != nil {
t.Fatalf("Record(%s): %v", s.name, err) // else the gate would measure the error path
}
const base = 4.0
if allocs := testing.AllocsPerRun(10000, func() { f.Record("x") }); allocs > base*1.10 {
t.Errorf("%s: %.1f allocs/op regressed past %.1f (baseline %.1f + 10%%); a record fence running per draw is the usual cause", s.name, allocs, base*1.10, base)