Skip to content

Commit eb8c1ce

Browse files
committed
perf: don't pre-allocate for rare cases
1 parent ff10385 commit eb8c1ce

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

types/payload.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,9 @@ func (p *Payload) MemoizeFields(keys ...string) {
568568
p.missingFields = make(map[string]struct{}, len(keys))
569569
}
570570

571-
keysToFind := make(map[string]struct{}, len(keys))
571+
// We memoize all key fields during ingest, it should be rare to
572+
// have keys not memoized, we will not prematurely allocate here
573+
keysToFind := make(map[string]struct{})
572574
for _, key := range keys {
573575
if _, ok := p.missingFields[key]; ok {
574576
continue

0 commit comments

Comments
 (0)