I am working on a project where I need to read in information from TOML files and then reference that data from other information read from other TOML files.
In essence, I have a set of library files that contain standard parts/pieces, and then I have a set of project files that reference the data in the project files to perform calculations, etc. (Think CAD / CAD related software).
Currently, I am storing the library files in hashmaps keyed with strings, and the values are Rc<RefCell<_>>. I store the references to the library contents in the project TOML files by string ID, and convert during the de-serialization process. Naturally this is fairly messy, and so I am thinking about refactoring to not use the Rc/RefCell and just pull the library information out when needed with hashmap lookups.
theoretically, what would be more performant? Maintaining reference counted references, or hashmap lookups?
You should always benchmark, but most probably HashMap lookup would be faster. You should also use fxhash instead of the default hasher (it is optimized towards security, not speed) and consider having plain vectors instead of multiple hashmaps, and a single HashMap would store the index into those vectors.
It depends on your application to be honest. I often just resort to &'static instead of Rc and fine grained Cells instead of coarse grained RefCell, or just a single Cell behind a &'static, or I may even go with lifetimes &'a. Again, highly depends on the kind of application.