Open
Description
Filing this as a continuation of #71926; in CL 672135 I optimized code like:
func BytesToHandle(b []byte) unique.Handle[string] {
return unique.Make(string(b))
}
This covers probably the bulk of the users, however "composite" cases where strings are inside a struct or array aren't optimized:
func BytesPairToHandle(b1, b2 []byte) unique.Handle[[2]string] {
return unique.Make([2]string{string(b1), string(b2)})
}
// --- or ---
type Pair struct {
S1 string
S2 string
}
func BytesPairToHandle(b1, b2 []byte) unique.Handle[Pair] {
return unique.Make(Pair{string(b1), string(b2)})
}
This would be good to improve, I just didn't as the corresponding optimization for dictionary keys is within the "order" part of the compiler when it's looking at (roughly) the syntax of a map access and I couldn't quicky come up with the code to do it for the unique.Make
calls.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo