-
Notifications
You must be signed in to change notification settings - Fork 30
fix: Use correct feature name for canbench profiling #296
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR corrects the feature flag used for canbench profiling to match the intended feature name defined in Cargo.toml.
- Update feature flag from "canbench" to "canbench-rs" in node_load and node_save functions in both v1 and v2 nodes
- Ensures that the profiling is only enabled when the correct feature is activated
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/btreemap/node/v2.rs | Updated feature flag in node_load_v2 and save_v2 |
src/btreemap/node/v1.rs | Updated feature flag in node_load_v1 and save_v1 |
Seems there's an issue with using scopes that can be repeated in benchmarks (e.g. when you call load multiple times) that I will need to figure out. |
I had that issue too. Initially I thought to create a key-value storage to record measurements for each unique scope. but it was adding too much of measurement overhead. so I went with another approach, to record the name and timestamp data point (the fastest I came up with) and only do a post-processing to aggregate time spans for each scope when printing the stats. see #274 |
I was thinking that the right solution would be for canbench to allow repeated scopes. Isn't that something that others might potentially need/be restricted by? Would everyone need to implement their own custom solution like you did? |
I've got a draft in canbench that allows a repeated scope to cover the cases of loops or a function be called repeatedly. I think that's a better approach to deal with this instead of canbench users trying to go around it. |
This change allows for repeated scopes to be used in canbench benchmarks. Previously the code would straight up refuse to have a similarly named scope -- I think this is a mistake, there are very valid scenarios ([example case](dfinity/stable-structures#296) from stable structures) where someone might have a loop and they want to declare a scope inside it to measure some operation. People should already be careful not declaring the same names for unrelated scopes, so I don't think a protection against it is worth it (that's I guess the main reason for this restriction currently) and the extra benefit you get to measure things inside loops (which can usually be where heavier parts of processing happens) outweighs some risk that someone re-uses the same name of scope.
The feature that enables specific canbench profiling of some code is named
canbench-rs
in Cargo.toml since a while ago. It seems that some of these were missed when the other cases were updated.