-
Notifications
You must be signed in to change notification settings - Fork 19k
cmd/compile: optimize []byte(string1 + string2) #62407
Copy link
Copy link
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.SuggestedIssues that may be good for new contributors looking for work to do.Issues that may be good for new contributors looking for work to do.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.help wanted
Milestone
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.SuggestedIssues that may be good for new contributors looking for work to do.Issues that may be good for new contributors looking for work to do.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.help wanted
Type
Projects
Status
Done
A somewhat common code pattern is
[]byte(string1 + string2).Today this gets compiled as two separate steps: concatenating the two strings into a new string, and then copying that string result into a new []byte slice.
But it shouldn't be too much trouble to have the compiler instead recognize these patterns (e.g., recognize an OSTR2BYTES whose operand is an OADDSTR), and optimize accordingly.