RC/RefCell vs hashmap lookup
⚓ Rust 📅 2025-09-27 👤 surdeus 👁️ 6I 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?
thanks in advance!
2 posts - 2 participants
🏷️ Rust_feed