Skip to content
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

Add routine to find when two functions take equal time #3

Closed
Bodigrim opened this issue May 28, 2024 · 2 comments
Closed

Add routine to find when two functions take equal time #3

Bodigrim opened this issue May 28, 2024 · 2 comments

Comments

@Bodigrim
Copy link
Owner

Take two Word -> Benchmarkable and return Word at which both of them take (roughly) the same time.

We probably want to start narrowing down the range with rough RelStDev / Timeout and use finer ones only later on.

data EqualizeConfig = EqualizeConfig {
  eqlBench1 :: Word -> Benchmarkable
  eqlBench2 :: Word -> Benchmarkable
  eqlLow :: Word
  eqlHigh :: Word
  eqlTimeout :: Timeout
  eqlRelStDev :: RelStDev
  }
@Bodigrim
Copy link
Owner Author

I'd imagine the following algorithm:

  • Take a rough RelStDev, say 20%. Check that eqlBench1 is significantly slower than eqlBench2 at eqlLow (mean1 + stdev1 < mean2 - stdev2) and vice versa at eqlHigh.
  • Take midpoint between eqlLow and eqlHigh, measure both functions. If measurements are significantly different, replace one of the endpoints with the midpoint and repeat. If measurements are not significantly different, decrease RelStDev and repeat.
  • Stop when eqlLow + 1 = eqlHigh or when Timeout happens before RelStDev is hit.

@wismill I noticed that you forked the repo. Is it a sign that you are interested to look into this issue? ;)

@wismill
Copy link

wismill commented Jun 1, 2024

@wismill I noticed that you forked the repo. Is it a sign that you are interested to look into this issue? ;)

Sorry, while I am very curious to see how this is implemented, I have other pending tasks. E.g. unicode-data and cabal deserves some love.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants