-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
What did you see?
Conversions like
string([]byte{...})
[]byte("...")
are not constant folded.
What did you expect?
Conversions of const literals should probably be constant folded because it significantly slows down
things like
for .... {
p.Write([]byte(":=")
}
This is related to #26264 but the scope of that issues should probably be the difference between Write, WriteByte, WriteString as some conversions not being constant folded is an issue on a different level that has little to do with the performance of these functions per se.
I can't quite tell whether []rune(...) is also not constant folded because I'm not sure what type.[]int32 actually does but for []byte(...) and string(...) there are calls to runtime.stringtoslicebyte(SB) and runtime.slicebytetostring(SB).
What version of Go are you using (go version)?
1.10.3
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Triage Backlog