-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shrink ElementWrapper to just the pointer and other optimizations.
Summary: The per thread ElementWrapper array can be very sparse and for a process where num_threads * num_thread_local_objects is large, it can produce significant memory overheads. By moving all the auxilliary information from ElementWrapper into the more compact ThreadEntrySet, we can eliminate 8 bytes per wrapper (sizeof(ElementWrapper) goes from 16 bytes to 8). As an added bonus, we can also now have accessAllThreads() use the copy of the per thread instance ptr stashed in ThreadEntrySet instead of accessing the elements array of a thread directly. The lock protecting the ThreadEntrySet is already held in the accessor and we no longer need it to also hold the StaticMeta's lock_. The meta.lock_ was otherwise held to prevent a thread's element array from being resized when the accessor might be trying to read from it. Reviewed By: yfeldblum Differential Revision: D58916891 fbshipit-source-id: fe0594a9706ded322c2ab6d4d461dba124733fbb
- Loading branch information
1 parent
0daffea
commit 10dfe0d
Showing
3 changed files
with
333 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.