Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce memory usage from Formatter cache
Previously this used Hashes and Arrays exclusively as an ad-hoc data structure. This ended up with a lot of empty arrays as well as hashes of size 1 with only the key ___routes. This introduces a CacheNode class which we can use to store the routes list separately (and avoids allocating the array and hash when unneeded). This also converts the one level hash with array keys ex. { [:controller, "home"] => ... } into a two-level hash. ex. { :controller => {"home" => ...} } This avoids array allocations in exchange for more hash allocations, I expect this to work out for the better as there is a ton of duplication of the key names (specifically :controller and :action in normal apps).
- Loading branch information