Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ruby: Use class inheritance to save memory
The only difference between all the `Message` classes is just their `descriptor` instance variable. So rather than create an entirely new class from scratch every time we can simply inherit from an abstract class. This shink each `Message` class from `1456` bytes to `944` bytes, and the singleton class of each from `960` to `792`, for a total of `680` bytes saved per message class, so a ~28% reduction.
- Loading branch information
Showing
2 changed files
with
37 additions
and
29 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