-
Notifications
You must be signed in to change notification settings - Fork 25
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
Could broker::table be unordered_map instead? #276
Comments
No strong opinion on the change (doesn't matter for Broker itself), but changing this to If we do this, It's probably also worth it to think about changing Would it be easy for you to change the types and generate new performance data? Having data on whether or not it's worth it to switch to the hash-based containers would provide some objective measure for the pro/con discussion. |
Thanks for the comments.
I think so. The test-case is "just" publishing a large table (1mio entries) table via I tried the obvious change and it was complaining about missing |
@awelzel if you want to give it a spin: the branch |
The branch unfortunately doesn't compile for me. Here's a test script though - it creates two tables each with 500k entries and publishes them to a connecting worker from the manager:
So this indicates we'd block for 2 seconds in script land before returning from the
|
I've only tested with Clang, sorry for not cross-checking the patch with other vendors! After reproducing this on GCC, it looks like the GCC implementation of the unordered containers does not work with forward-declared types. Seems like the standard only requires smart pointers, The only way to get this working with GCC's version of the standard library would be forcing heap indirections at some point. Pointers always have the same size, so the compiler can create a memory layout without needing the size of the pointed-to-type. There are basically two options to do that in Broker:
The latter is probably the way to go (less intrusive and fewer memory allocations), but at that point we're no longer talking about a drop-in replacement and are no longer "just" changing the iteration order but actually break the API. Should I go ahead and make the changes on the branch for testing purposes or is that a deal breaker right away? |
No real opinion. I don't have hunch how much faster it could be - so would still be interesting to test it if the implementation isn't too involved (assuming breaking the API is okay to just do the comparison). If it's vastly better, might be worth considering it. At the same time, while we have that one user of |
A couple of thoughts here:
Therefore, unless you think you'll get to this one in the near future Dominik, I'd close this and possibly revisit at a later time. |
If it's just for getting a first impression: can you build that branch using |
Testing some scenarios in zeek/zeek#2394,
_Rb_tree
code is standing out in the profiles for publish_id of a table with 1mio entries. Maybe usingstd::unordered_map
forbroker::table
could improve performance for such large tables?broker/include/broker/data.hh
Lines 40 to 41 in 5e64f93
The text was updated successfully, but these errors were encountered: