-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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.Performance
Milestone
Description
This is os.File.WriteString's implementation:
// WriteString is like Write, but writes the contents of string s rather than
// a slice of bytes.
func (f *File) WriteString(s string) (n int, err error) {
return f.Write([]byte(s))
}
This currently accounts for 10% 35% of allocated space in a service I'm maintaining.
We should be able to do an unsafe cast of s
to b
here, and avoid the allocation.
Do any kernels modify the bytes during Write
? Any other reason why we wouldn't be able to do this?
cc @bradfitz
cespare, bcmills, prashantv, davecheney, OneOfOne and 5 more
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.Performance