Several complex data-block management requires to go over a large part of the Main data-base to find and follow relationships between IDs. Caching those relationships could make this much more efficient.
A first approach of this issue has been addressed when MainIDRelations *relations temporary mapping was added (mapping any given ID to all of the IDs it uses, and all of the IDs it is used by), to improve performances of things like making a whole set of IDs from linked to locals in a single pass.
However, this is currently assumed dirty, and to have a short-term life. Code that needs it has to generate it, and free it asap.
There are at least two ways to keep that kind of cache in a more permanent way:
- Store used-by pointers in every ID.
- Keep current ghash approach, but find ways to keep it valid and up-to-date at a reasonable cost.
TODO: investigate further pros and cons of both ideas…