Audit sequence identity scaling and lifecycle
This commit is contained in:
@@ -812,11 +812,11 @@ func (s *importTraversal) composePendingItems(scope *acquisitionScope, policy se
|
||||
func acquiredSequenceDeclarations(scope acquisitionScope) []sequenceDeclarationSpec {
|
||||
var declarations []sequenceDeclarationSpec
|
||||
for _, contribution := range scope.contributions {
|
||||
for _, declaration := range contribution.sequenceDeclarations {
|
||||
projected := cloneSequenceDeclarations([]sequenceDeclarationSpec{declaration})[0]
|
||||
projected.destination = appendDestination(contribution.relativeDestination, declaration.destination)
|
||||
declarations = append(declarations, projected)
|
||||
projected := cloneSequenceDeclarations(contribution.sequenceDeclarations)
|
||||
for index := range projected {
|
||||
projected[index].destination = appendDestination(contribution.relativeDestination, projected[index].destination)
|
||||
}
|
||||
declarations = append(declarations, projected...)
|
||||
}
|
||||
return declarations
|
||||
}
|
||||
|
||||
42
internal/engine/sequence_combine_bench_test.go
Normal file
42
internal/engine/sequence_combine_bench_test.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/ConfigKit/internal/document"
|
||||
)
|
||||
|
||||
func BenchmarkSequenceMixedUpsert(b *testing.B) {
|
||||
for _, size := range []int{128, 512, 2048} {
|
||||
b.Run(strconv.Itoa(size), func(b *testing.B) {
|
||||
lower := benchmarkSequenceRecords(0, size, "lower")
|
||||
higher := benchmarkSequenceRecords(size/2, size, "higher")
|
||||
context := sequenceCombinationContext{destination: Keys("items")}
|
||||
identityFields := []string{"id"}
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
for range b.N {
|
||||
if _, diagnostics := combineIdentifiedSequences(
|
||||
lower, higher, sequenceModeUpsert, identityFields, context,
|
||||
); len(diagnostics) != 0 {
|
||||
b.Fatal(diagnostics)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func benchmarkSequenceRecords(start, count int, value string) *document.Node {
|
||||
items := make([]*document.Node, count)
|
||||
for index := range count {
|
||||
items[index] = &document.Node{
|
||||
Kind: document.Mapping,
|
||||
Mapping: []document.Entry{
|
||||
{Key: "id", Value: &document.Node{Kind: document.String, Text: "item-" + strconv.Itoa(start+index)}},
|
||||
{Key: "value", Value: &document.Node{Kind: document.String, Text: value}},
|
||||
},
|
||||
}
|
||||
}
|
||||
return &document.Node{Kind: document.Sequence, Sequence: items}
|
||||
}
|
||||
Reference in New Issue
Block a user