-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a performance optimization to zero-argument methods; these methods now have their memoized results stored in an array rather than a hash. This is the same as the recent optimization we made for one-argument methods, except because we store zero-argument results directly (rather than a hash containing results as with one-argument methods), we need a sentinel system to differentiate between an unmemoized method (in which case the lookup will return `nil`) and a memoized result that also happens to be `nil`. This optimization offers a slight speedup because array accesses are faster than hash lookups. In addition, this optimization is faster even for the "slow path" case in which the memoized value is falsey, because previously that check was also performing a hash lookup and our new sentinel system uses an array for this as well.
- Loading branch information
1 parent
422de9e
commit d768e10
Showing
4 changed files
with
117 additions
and
75 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
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