Skip to content

Commit 026e5f9

Browse files
perf: use append instead of Concat in appendLookupLocations (microsoft#632)
1 parent 4389109 commit 026e5f9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

internal/compiler/module/cache.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package module
22

33
import (
4-
"slices"
54
"strings"
65
"sync"
76

@@ -96,9 +95,9 @@ func (c *resolutionCache[T]) appendLookupLocations(resolved T, failedLookupLocat
9695
c.mu.Lock()
9796
defer c.mu.Unlock()
9897
lookupLocations := c.lookupLocations[resolved]
99-
lookupLocations.FailedLookupLocations = slices.Concat(lookupLocations.FailedLookupLocations, failedLookupLocations)
100-
lookupLocations.AffectingLocations = slices.Concat(lookupLocations.AffectingLocations, affectingLocations)
101-
lookupLocations.ResolutionDiagnostics = slices.Concat(lookupLocations.ResolutionDiagnostics, resolutionDiagnostics)
98+
lookupLocations.FailedLookupLocations = append(lookupLocations.FailedLookupLocations, failedLookupLocations...)
99+
lookupLocations.AffectingLocations = append(lookupLocations.AffectingLocations, affectingLocations...)
100+
lookupLocations.ResolutionDiagnostics = append(lookupLocations.ResolutionDiagnostics, resolutionDiagnostics...)
102101
}
103102

104103
type perDirectoryResolutionCache[T any] struct {

0 commit comments

Comments
 (0)