1

The Google microbenchmark library supports estimating complexity of an algorithm but everything is expressed by telling the framework what the size of your N is. I'm curious what the best way to represent M+N algorithms in this framework is. In my test I go over a cartesian product of M & N values in my test.

Do I call SetComplexityN with M+N (& for O(MN) algorithms I assumed SetComplexityN is similarly M*N)? If I wanted to hard-code the complexity of the algorithm (vs doing best fit) does benchmark::oN then map to M+N and benchmark::oNSquared maps to O(MN)?

Vitali
  • 3,411
  • 2
  • 24
  • 25

1 Answers1

0

It's not something we've yet considered in the library.

If you set the complexity to M+N and use oN then the fitting curve used for the minimal least square calculation will be linear in M+N.

However, if you set the complexity to M*N and use oNSquared then we'll try to fit to pow(M*N, 2) which is likely not what you want, so I think still using oN would be appropriate.

dma
  • 1,758
  • 10
  • 25