Dynamic `OperationsPerInvoke`
See original GitHub issueI load a list of strings externally as data for my benchmarks. My goal is to measure average time for me to process one string. Of course the data is loaded before benchmarking, but since it happens at runtime, I cannot supply OperationsPerInvoke
attribute param to BenchmarkAttribute
, which requires compile-time constant. Is there a way around?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:26 (18 by maintainers)
Top Results From Across the Web
DynamicObject.TryInvoke(InvokeBinder, Object[], ...
Provides the implementation for operations that invoke an object. Classes derived from the DynamicObject class can override this method to specify dynamic ......
Read more >powerful benchmarking in .net
profiling") is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity ... [Benchmark(OperationsPerInvoke = 4)].
Read more >Benchmarking and Exploring C#'s Dynamic Keyword
Today I wanted to explore and benchmark a C# feature that I've never used before, the dynamic type. Dynamic v. Static Type Systems....
Read more >Custom and not-constant "Operations per invocation" (Re
operationsPerInvocation (...) to match your .params(...) if you want to normalize the operations like that. > Looks like "@AuxCounters" is ...
Read more >How to use JMH properly? Example with ArrayList
Also the notion of operation can be "altered" with @OperationsPerInvocation - which is another sharp tool.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As a workaround- I’ve resorted to using a Source Generator that creates a class named BenchmarkConstants where I have all of the dynamically calculated stuff (like the size of my Enums) placed as constants.
My initial idea was:
this extra method would be executed once, after stoping the watch, before last iteration/global cleanup. Then serialized and available in the results, so people could use sth like this in the columns: