-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Enhancement: Reducing memory usage by removing the vtable in managed. #874
Conversation
Realized that I had done this wrong in the previous implementation. Also edited the name of a variable. Also, just edited the loads to use aligned loads instead of unaligned.
…well as encapsulating some of their functions. Can't believe I didn't notice this before.
Have applied the CRTP to keep the interfaces identical, as well as added snowflakes to the necessary classes.
✅ Deploy Preview for dpp-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
public: | ||
//** Unique identifier */ | ||
snowflake id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like this, it's basically added tons of duplicate lines to every object to save 8 bytes of ram per instance, I think readability is more important in this case
The id could be part of managed, that would help with the code duplication |
It was deliberately removed from managed in order to eliminate the vtable. |
Having just the snowflake in there isn't going to produce a vtable though. |
No but having the virtual destructor that is then required to properly destroy the snowflake will. |
Virtual destructor is needed if you want to destroy a variable through a pointer to its base class, so the derived object is properly destroyed. Whether the snowflake is in the base or not doesn't change that |
Have applied the CRTP to keep the interfaces identical, as well as added snowflakes to the necessary classes, and also added a managed_base class to allow for storing them all in the same deletion_queue.
Code change checklist