-
Notifications
You must be signed in to change notification settings - Fork 0
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
[DMS-75] Store black height in type #26
base: sereja/specialize-persistentorderedset
Are you sure you want to change the base?
[DMS-75] Store black height in type #26
Conversation
Store the black height in the type to avoid recalculating it for set operations.
0104a3b
to
1219b26
Compare
I see that all operations except intersect, union, diff become slower on ~3-4%. However, the speed up of the intersect, union, and diff is significant. I am wondering if can we precalculate black depth and only there. |
I tried to calculate bh in these functions in #31 but it's not so easy to track what change we need to make to the height because it depends on the color of the parent/child node and therefore requires a lot of case analysis in internal functions which leads to significant slowdown. As for precalculating bh in just these functions, this will require going through all the paths of both trees, even those paths that we don't actually need. I tried to find examples of something like this, but there doesn't seem to be a better way than just storing the bh in the type, this is also suggested in Nipkow's book. |
I think this table makes it more clear
|
Profiling branch: https://github.com/serokell/canister-profiling/tree/sereja/set-profiling
Baseline: https://github.com/serokell/motoko-base/tree/sereja/specialize-persistentorderedset (9ebd08f)
Collection benchmarks
set API
new set API