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

Investigate proto.Clone performance impact #80

Closed
kruskall opened this issue Jun 21, 2023 · 2 comments
Closed

Investigate proto.Clone performance impact #80

kruskall opened this issue Jun 21, 2023 · 2 comments

Comments

@kruskall
Copy link
Member

Local benchmarks show proto.Clone taking a small amount of CPU time (~8% total time). It's probably not enough to cause a regression but it's not great that something we introduced is taking a noticeable CPU time as it would decrease the impact of other performance improvements.

Clone is using reflection under the hood, we should try to minize its usage.

@kruskall kruskall changed the title Investigate proto.Clone performance issue Investigate proto.Clone performance impact Jun 21, 2023
@axw
Copy link
Member

axw commented Jun 21, 2023

https://github.com/planetscale/vtprotobuf

clone: generates the following helper methods

func (p *YourProto) CloneVT() *YourProto: this function behaves similarly to calling proto.Clone(p) on the message, except the cloning is performed by unrolled codegen without using reflection. If the receiver p is nil a typed nil is returned.

@kruskall
Copy link
Member Author

Closed by #87

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

No branches or pull requests

2 participants