INCATools / whelk-rs

Whelk is an OWL EL reasoner
MIT License
11 stars 4 forks source link

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

Open balhoff opened 1 year ago

balhoff commented 1 year ago

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 commented 1 year ago

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.