-
Notifications
You must be signed in to change notification settings - Fork 221
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
Improve performance of Reader get_named #455
Comments
Thanks for the report. We have a TODO in the code about this: capnproto-rust/capnp/src/introspect.rs Line 217 in eb5b768
capnproto-c++ has implemented this via binary search: |
I started adding a hashmap in a fork but I cannot re-generate the code because the previously generated code does not compile with the new field:
I tried removing the old generated file but that led to other errors for files that depend on that file. Any advice on how to add a new field and re-generate the generated files? I also went down the path of a hashmap since the C++ code also had a todo suggesting this. We lose the Copy trait on RawStructSchema and I do not know the implications of that. This seems like a viable path but willing to redo doing binary search instead. |
You'll probably need to hand-edit the existing checked-in schema_capnp.rs.
My impression is that |
Closing because #469 has landed. |
I was doing some performance testing of code that serializes a large number of capnp messages. The biggest bottleneck is
capnp::dynamic_struct::Reader.get_named
because it does anO(N)
lookup of the field names, converts them to text and compares them to the input.I was wondering if you would be open to a contribution that improves the performance of this method.
Naively I was thinking of solving this with a
HashMap
that populates the names of fields as keys and fields as values. This could be populated at runtime after anO(N)
lookup.The text was updated successfully, but these errors were encountered: