Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Deduplicate various Active Record schema cache structures #35891
Real world database schemas contain a lot of duplicated data.
This result in a lot of wasted memory.
The idea here is to make these data sctructures immutable, use a registry
This is mostly a refactor of #35860, instead of using the constructor arguments as cache key, I first instantiate the structure, and then look them up in the registry.
This makes for much cleaner code, and also provide a hook for deduplicating the internal values like #35860 did, which save a lot of CPU compared to deduplicating them on instantiation.
I also update the
I'll add more comments on the diff.
I posted various memory and CPU profiles in the related PRs. Today I shipped this PR as monkey patch on our app, and the resident memory difference is absolutely massive.