-
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.
Use smaller enum types to reduce object sizes. (#207)
* Use smaller enum types to reduce object sizes. If a model has lots of enums, making them smaller instead of 64-bit NSInteger types will help. Apple only uses 64-bit enums since they need to guarantee binary compatibility for years, even after they add new enum values. Since this is generated source and re-compiled into applications, this does not apply. Building the integration models works. However Pinterest builds with -Werror -Wconversion. This means the -decodeIntegerForKey: needs a cast to the enumeration type name. However down in decodeStatement I do not see how to get the enumeration type name for casting. This is only applicable to ObjC, since it is the place where these C types will save some space. * mark location where enum type needed * fix lints * update linux tests * run swiftformat * Add notes where mz thinks this should occur. * Determine enum range by looking at the actual values before emitting code this time. * emit type name when decoding. delete now useless tests. * remove deleted tests from linux too * cast enum type name when initing from dictionary * run swiftformat * run integration_test * remove files not part of this PR * rename to underlyingIntegralType * move EnumType to integraltype into a helper function for testing. Add tests. * run swiftformat * add new linux tests * Use string enumeration for ObjC enum integral types. * run swiftformat and fix tests * add code comment explaining the motivation and effects * run swift lint * clean up and correct comment information * make a func on the enum to do the conversion as reviewed by jparise * Improve code by improving tests. Add new enumeration types to everything.json. * run format * group the enum properties together in property declarations in the category to group them together in memory layout. * Update Sources/Core/ObjectiveCIR.swift Thanks! Co-Authored-By: Jon Parise <[email protected]> * rename all of them * run format * Move enum tests to their own file and separate them out individually. * remove unnecessary isEmpty check as caught in review * rename enumerationIntegralTypeFor to forValue as per review * use --> as per review
- Loading branch information
1 parent
ef88906
commit d3c6322
Showing
19 changed files
with
1,089 additions
and
73 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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.