-
-
Notifications
You must be signed in to change notification settings - Fork 984
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
Allow for benchmark categories composition using inheritance #2306
Comments
@BladeWise Thanks for the feedback. In #2307, I have implemented the following:
Does it solve your problem? Do you have any comments on the implementation? |
The PR solves the above issue perfectly, and the implementation is flexible enough to account for custom discovery strategies. I am not sure if it would be worth to add an explicit configuration extension method to revert to the old behavior (or eventually opt-in to the new one), something like public static ManualConfig WithCategoryDiscoverer(this IConfig config, bool inherit) => config.With(m => m.CategoryDiscoverer = new DefaultCategoryDiscoverer(inherit)); The |
Well, with the current state of the PR, it's possible to do config.WithCategoryDiscoverer(new DefaultCategoryDiscoverer(false)) I believe there is no need for an additional shortcut method.
Great, glad to hear that. Then I merge the PR.
You're welcome! |
I am writing some benchmarks over generic classes, and to do so I created base generic benchmark, something along these lines
Actual benchmarks are specialized over the generic type
The problem is that the category defined on the derived class is not assigned to the methods declared on the base class, because
BenchmarkConverter
only looks at the method declaring type. Moreover, the attribute on the derived class replaces the one defined on the base class, because the current resolution strategy ignores inherited attributes.Is there a reason why
method.ReflectedType
is not used in this case and inherited attributes are explicitly ignored (both at the class and method level)?So far, the only option is to replicate the categories on both the derived class and overridden method.
Would it be possible to add an extension point to the
BenchmarkConverter
(e.g., anICategoryResolver
or aCategoryResolver
delegate) to plug-in a different categories discovery logic?The text was updated successfully, but these errors were encountered: