-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit BOOL properties as bitfields (#208)
* Emit BOOL properties as bitfields This will make Pinterest models smaller in the heap, which is useful since they live for the life of the application. This changes only the model, not the short lived builders, to use bitfields. It requires special handling of boolean properites throughout the process. In Pinterest, PIPin has 25 BOOLs (currently stored as 200 bytes, which takes 4 bytes afterwards), & PIUser has 40 (currently stored as 320 bytes, and takes 8 bytes afterwards). There may be even more wins, simply by grouping all the BOOLs near each other. If the layout of a class is a pointer, follwed by a BOOL, followed by a pointer, the 64 bit alignment of fields will cause that BOOL to actually be 8 bytes! * compare with 1 when assigning from builder to pass build warnings in app * set the bitfield to the decoded BOOL & 0x1 to suppress compiler warnings in the app. copied from the dirty options code * swift format it * remove local path in scheme file * use bitwise AND, as per review * regenerate test code after last commit * fix up empty newlines added * get rid of more added blank lines * make format * add extension on Schema to indicate if it is a .boolean or not and use it where applicable. * make format * fix typo and re-run format * re-instate implementing equality hash and getters so that old ivars are not generated. lost in a merge conflict along the way.
- Loading branch information
1 parent
47fb542
commit d4a714d
Showing
10 changed files
with
217 additions
and
100 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
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.