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
Use proper shared memory on Linux, and cache things #19
Comments
@bill-myers thank you a lot for the feedback. Everything you mention was already in the back of my head. I have split this issue into:
So that we can discuss and implement these independently without interleaving both discussions. There is one thing from your comment that I don't understand. Maybe you could elaborate. Currently the library uses The files in So if consuming file-descriptors is what you mean with this being very slow, Another tangential topic is using
I also explored using
Systems programming is a bit new to me so I'd like learning about all of this in more detail. Feel free to submit PRs or discuss my thoughts on the issues in more detail. Any information that you post there will allow anybody to implement things faster. My thoughts on the allocator part are a bit rough still because my mind was prioritizing other parts of the library so if you want to tackle that it would be better if you could explain exactly what and how you want to do on the allocator issue so that we are on the same page before sending a PR, but otherwise, happy hacking! (*): using |
This has been fixed.
This has been fixed as well. On Linux it uses a non-racy
These two points are the same issue: Adding an allocator that recycles memor, and tracked on issue #21 . |
Currently the code creates and maps a file in /tmp for each structure created, which is obviously completely unacceptable, since /tmp is not supposed to be used for this purpose and with this frequency and the syscall overhead will result in unusably slow performance in many cases.
This means the crate is currently only usable for long-lived deques if one is OK with files being randomly created in /tmp as part of normal operation of a propgram.
Instead, it should first of all use shared memory (with memfd_create, /dev/shm or SysV IPC) instead of /tmp, and second it should probably share one file descriptor among allocations where possible and finally it should probably at least cache some of the smaller buffers so that no syscalls are required if e.g. a function that uses a few SliceDeques internally is called in a loop.
The text was updated successfully, but these errors were encountered: