-
Notifications
You must be signed in to change notification settings - Fork 273
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 TLS for big temporary structures #370
Comments
Can you elaborate? We definitively can use thread local globals, but how do you propose coding this up? |
I'd need to check the code again to look for places where it would be useful, but I was thinking mostly of lazy operations or those working on multiple bitmaps at a time that may use a container as an accumulator and then convert it to whatever is appropriate depending on its cardinality. The temporary bitmap container could be recycled by sharing a TLS global. |
BTW, sorry for the long delay to answer, I was actually on vacation and wrote the issue just so I wouldn't forget about it. |
There is no doubt that we are sometimes limited by memory allocation. I think it is worth pursuing. |
Given that we are already not reentrant (malloc can't be used in signal handlers and we make extensive use of it), nor can I think of reasonable scenarios where we would want that, and that we avoid recursion as much as we can (even if not explicitly a goal, it just happens to be the case), we may avoid many allocations by just using thread local storage globals (or statics if we want cleaner code) for them.
I think it's worth benchmarking to see whether it makes sense. I'm thinking mostly of the places where we would store a bitmap for mass operations.
The text was updated successfully, but these errors were encountered: