Aeledfyr / deepsize

A rust crate to find the total size of an object, on the stack and on the heap
MIT License
103 stars 19 forks source link

Implement `deep_size_ignore_cycles` method, which ignores cycle checking #26

Closed pmnoxx closed 2 years ago

pmnoxx commented 2 years ago

Doing allocations for purpose of checking size of data structure can be expensive. Current implementation uses a dynamic datastructure, which contains two sets.

            arcs: GenericSet::new(),
            rcs: GenericSet::new(),

In our use case, computation is too slow, because we count sizes of structures containing large Vectors

Vec<Arc<MyStruct>>>

Each, MyStruct is unique, can be large, Arc is just used to share data between threads, and avoiding copies.

I propose no_context feature, which disables Arc, Rc counting, as that can have performance implications.