Performance improvement can be made for `Marshaler.Get`.
sean2077 opened this issue · comments
Performance improvement can be made for Marshaler.Get
.
Here []bytes(v)
can be replace with String2Bytes(v) cast funciton.
func String2Bytes(s string) []byte {
sh := (*reflect.StringHeader)(unsafe.Pointer(&s))
bh := reflect.SliceHeader{
Data: sh.Data,
Len: sh.Len,
Cap: sh.Len,
}
return *(*[]byte)(unsafe.Pointer(&bh))
}