Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test putting model structures directly in im collections rather than in Rc #21

Open
balhoff opened this issue Mar 8, 2023 · 1 comment
Assignees

Comments

@balhoff
Copy link
Member

balhoff commented Mar 8, 2023

Here are docs on this for im: https://docs.rs/im/latest/im/#values

I think most of the data structures from model.rs that we put into sets and hash maps implement Clone (or they could). Right now everything in the reasoner.rs state collections is in Rc, e.g.,

hier_comps: HashMap<Rc<Role>, HashMap<Rc<Role>, Vector<Rc<Role>>>>,

if we make everything more like

hier_comps: HashMap<Role, HashMap<Role, Vector<Role>>>,

how does this affect speed and overall memory usage?

All the model structures should be considered immutable. Does that affect the clone implementation? Can we implement something that doesn't deep copy all nested structures?

@balhoff balhoff self-assigned this Mar 9, 2023
@balhoff
Copy link
Member Author

balhoff commented Mar 14, 2023

I tested this on https://github.com/INCATools/whelk-rs/tree/no-rc-experiment. The code on that branch seems to be slightly slower, and possibly use even more memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant