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

FlatBuffers #3

Open
rw opened this issue Sep 3, 2018 · 5 comments
Open

FlatBuffers #3

rw opened this issue Sep 3, 2018 · 5 comments

Comments

@rw
Copy link

rw commented Sep 3, 2018

Cool project! Could I suggest that you try to incorporate the new FlatBuffers Rust port that just landed? google/flatbuffers@3c54fd9

@jeikabu
Copy link

jeikabu commented Jan 7, 2019

@rw
I didn't see this, but I made an attempt to add FlatBuffers: #4

The results seem a bit... off. I'm not entirely sure about the differences between what FlatBuffers and the rest are doing, so it's likely comparing apples to... a different kind of apple.

I used 1.10 instead of HEAD.

@rw
Copy link
Author

rw commented Jan 8, 2019

@jeikabu Your complex_build seems to be causing heap allocations.

  1. Re-use the builder by calling .reset() on it to re-use the memory. This is very important to do in tight loops, like in benchmarks.
  2. Don't use .to_vec in builder.finished_data().to_vec(), because that causes an alloc.
  3. HEAD might be better but I don't think you're using any functionality that has landed since 1.10.
  4. Thanks for doing this! :-)

@rw rw mentioned this issue Jan 8, 2019
@jake-ruyi
Copy link

  1. Ok
  2. to_vec() was actually intentional because both capn and protobuf are generating a Vec<_>, but I'll go ahead and remove it. I suspect the other two need to be updated anyway.
  3. Release 1.11! ;)

@jeikabu
Copy link

jeikabu commented Jan 9, 2019

After looking at it again re-creating the builder was also intentional as the capnp bench does the same thing. Hardly seems fair to move it out without doing it to the others. Switching new() for new_with_capacity() was a big win, though.

@rw
Copy link
Author

rw commented Jan 9, 2019

@jeikabu I think if you don't re-use Builders, then you're basically benchmarking Rust's heap allocator... not flatbuffers :-)

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

3 participants