Improve D&D registry normalization efficiency
This commit is contained in:
@@ -85,6 +85,20 @@ func TestNormalizeConsolidatesEqualNamesAcrossEvidenceWithoutMutation(t *testing
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkComparisonNameGroupsManyDistinct(b *testing.B) {
|
||||
records := make([]normalizedRecord, 1_000)
|
||||
for index := range records {
|
||||
records[index] = normalizedRecord{item: dnd.Item{Name: "Item " + strconv.Itoa(index)}}
|
||||
}
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
for iteration := 0; iteration < b.N; iteration++ {
|
||||
if groups := comparisonNameGroups(records); len(groups) != len(records) {
|
||||
b.Fatalf("group count = %d, want %d", len(groups), len(records))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeAppliesSafeAliasProposal(t *testing.T) {
|
||||
doc := semanticDocument()
|
||||
input := dnd.ItemRegistry{Items: []dnd.Item{
|
||||
|
||||
Reference in New Issue
Block a user