-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fast-path protoreflect.Message methods #3
Comments
I could take care of implementing this. Adding here more findings regarding my experimentations:
I was experimenting by creating an object which wraps the fast reflection API logic, in order not to pollute the object with many methods (especially in case we might extend this interface in the future): // autogenerated by our impl
type messageTestFastReflection {
x *TestFastReflection
}
func (x messageTestFastReflection) GetFieldByName(name protoreflect.Name) {
... logic
}
// autogenerated by protoc-gen-go
type TestFastReflection {
}
func (x *TestFastReflection) FastReflection() messageFastReflection {
return messageTestFastReflection{x}
} ^ This would look cleaner API wise (note: messageFastReflection would be substituted by a fastreflection interface which is TBD), but at the same time adds a little bit of performance overhead (I don't have clear numbers yet, will get them tomorrow). |
That would be great @fdymylja 👍 @technicallyty can you push your latest code to a branch? Let's find a way to coordinate with PRs. I think it makes sense to just implement the whole |
updated my branch with my latest progress |
Looks like all the |
Needed for custom types and
Any
s, will also speed up other codes.Types to implement:
ProtoReflect.Messsage:
Protoreflect.List:
Protoreflect.Map:
Ex for https://pkg.go.dev/google.golang.org/[email protected]/reflect/protoreflect#Message
Has
method:If we wanted to reuse the default protoreflect implementation, maybe this will work but it won't speed up other code:
Implementing all of the
protoreflect.Message
methods to be as fast as possible is the goal. Some benchmarks are here: cosmos/cosmos-sdk#9156 (reply in thread).The text was updated successfully, but these errors were encountered: