Skip to content

Conversation

yjhmelody
Copy link

@yjhmelody yjhmelody commented Nov 18, 2020

I found that some operations are very expensive about mem alloc when string(bytes).
Such as:

image

So I try to reuse some mems by using unsafe.

@mitar
Copy link

mitar commented Sep 16, 2022

Just for the record, this is done inside standard library as well: https://go.dev/src/strings/builder.go#L46

@mitar
Copy link

mitar commented Sep 16, 2022

Although there will be soon official public API to do this: golang/go#53003

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants