Reduce allocations (#17584)
* Reduce allocations * Add stringsHasPrefixFold which can compare string prefixes, while ignoring case and not allocating. * Reuse all msgp.Readers * Reuse metadata buffers when not reading data. * Make type safe. Make buffer 4K instead of 8. * Unslice
This commit is contained in:
@@ -402,7 +402,7 @@ func extractETag(metadata map[string]string) string {
|
||||
// to do case insensitive checks.
|
||||
func HasPrefix(s string, prefix string) bool {
|
||||
if runtime.GOOS == globalWindowsOSName {
|
||||
return strings.HasPrefix(strings.ToLower(s), strings.ToLower(prefix))
|
||||
return stringsHasPrefixFold(s, prefix)
|
||||
}
|
||||
return strings.HasPrefix(s, prefix)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user