Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimization: using mashal to replace proto clone #5477

Closed
bufferflies opened this issue Sep 7, 2022 · 0 comments · Fixed by #5480
Closed

optimization: using mashal to replace proto clone #5477

bufferflies opened this issue Sep 7, 2022 · 0 comments · Fixed by #5480
Assignees
Labels
type/development The issue belongs to a development tasks

Comments

@bufferflies
Copy link
Contributor

bufferflies commented Sep 7, 2022

Development Task

Proto.Clone is too expensive:

// origin 
copyLeader := proto.Clone(leader).(*metapb.Peer)
// new
b, _ := leader.Marshal()
copyLeader := &metapb.Peer{}
copyLeader.Unmarshal(b)

before :
image

after
image

@bufferflies bufferflies added the type/development The issue belongs to a development tasks label Sep 7, 2022
@bufferflies bufferflies changed the title optimization:using mashal to replace proto clone optimization: using mashal to replace proto clone Sep 7, 2022
@bufferflies bufferflies self-assigned this Sep 8, 2022
ti-chi-bot pushed a commit that referenced this issue Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/development The issue belongs to a development tasks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant