Fix nested inheritance history and budget accounting
This commit is contained in:
@@ -58,6 +58,28 @@ func BenchmarkInheritanceInspectedLoad(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
// Each scope has constant-sized output and evidence. This distinguishes budget
|
||||
// accounting overhead from legitimate growth in expanded parent payloads.
|
||||
func BenchmarkInheritanceIndependentScopes(b *testing.B) {
|
||||
for _, size := range []int{256, 512, 1024} {
|
||||
b.Run(strconv.Itoa(size), func(b *testing.B) {
|
||||
input := &document.Node{Kind: document.Mapping}
|
||||
for index := 0; index < size; index++ {
|
||||
input.Mapping = append(input.Mapping, document.Entry{
|
||||
Key: strconv.Itoa(index), Value: inheritanceBenchmarkInput("wide", 1),
|
||||
})
|
||||
}
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
for range b.N {
|
||||
if _, diagnostics := expandInheritanceTree(input, defaultProjectionLimits()); len(diagnostics) != 0 {
|
||||
b.Fatal(diagnostics)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func inheritanceBenchmarkInput(shape string, size int) *document.Node {
|
||||
value := func(text string) *document.Node { return &document.Node{Kind: document.String, Text: text} }
|
||||
mapping := func(entries ...document.Entry) *document.Node {
|
||||
|
||||
Reference in New Issue
Block a user