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

Non-Arc iterators / Interior iteration. #285

Open
XAMPPRocky opened this issue Oct 22, 2023 · 1 comment
Open

Non-Arc iterators / Interior iteration. #285

XAMPPRocky opened this issue Oct 22, 2023 · 1 comment

Comments

@XAMPPRocky
Copy link

Hello πŸ‘‹ I've been benchmarking https://github.com/googleforgames/quilkin and while benchmarking I noticed that we spend a significant amount of CPU time just allocating and dropping the Arc in GuardIter (~5–10%). Because we need to iterate over the map in every packet. In our case the use of the Arc is not really needed because we're immediately consuming the iterator.

I was wondering if there's any interest in providing support for iterators that don't use Arc, or providing a way to map/reduce that doesn't involve Arc? I think this would provide significant performance benefits for those who are trying to perform an operation over the whole map immediately over the current implementation.

Code

# DashMap<String, BTreeSet<SocketAddr>
map.iter().map(|entry| entry.value().len()).sum()

Flamegraph

Screenshot 2023-10-22 at 15 43 33
@XAMPPRocky
Copy link
Author

I should note this is with a single entry in the map, it gets worse as the map gets larger.

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

1 participant