cmd/compile: optimize switch string(byteSlice) lookups #24937
Labels
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
Milestone
I see this pattern commonly:
(Instances of this pattern exist in the standard library.)
Here an allocation is made for the string, copying the contents of the
[]byte
. It'd be great if the contents of the slice could be used without an allocation of a string, using simply a string header pointing to the same location as the slice. This will avoid creating a ton of garbage.This is the same kind of proposal as #3512 by @bradfitz (and I think the implementation would look similar).
The text was updated successfully, but these errors were encountered: