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

Allow benchmarking of sequential functions #446

Open
jni opened this issue Jun 22, 2016 · 4 comments
Open

Allow benchmarking of sequential functions #446

jni opened this issue Jun 22, 2016 · 4 comments
Labels
enhancement Triaged as an enhancement request

Comments

@jni
Copy link
Contributor

jni commented Jun 22, 2016

From my reading of Writing benchmarks, setup functions are run once per benchmark. Sometimes, however, one benchmark's test is another benchmark's setup. When functions take a long time to run, it'd be great to be able to use the results of a benchmark as the setup for the next one.

Here's my own use case:

  • load data
  • build training graph (needs time and memory benchmarking)
  • run one training epoch (time + memory benchmarking)
  • run four more training epochs (they depend on the first and are qualitatively different) (time + memory benchmarking)
  • build testing graph
  • build testing priority queue (needs time and memory benchmarking)
  • process testing graph (time + memory benchmarking)

Most of these are big operations that take some time to run, so it's annoying to have to run the whole pipeline again to run the final benchmark. And the objects are big and complex, so pickling saves some time but is still expensive.

Any suggestions?

Thanks!

@pv pv added the enhancement Triaged as an enhancement request label Jun 22, 2016
@pv
Copy link
Collaborator

pv commented Jun 22, 2016

This probably goes to the feature wishlist, not directly supported right now. Some overlap probably with #179 (the benchmark is logically a single benchmark with multiple returns, if the different parts cannot really be run separately).

You can sort of cobble it together by running all of the steps in setup_cache, doing the measurements using your own custom memory and time tracking, and saving the results to cache. The cached results are then reported to asv by a bunch of track_* "benchmarks" that just return the cached benchmark result values. This still allows you to benefit from the reporting and analysis parts of asv.

@jni
Copy link
Contributor Author

jni commented Jun 23, 2016

@pv thanks! I'm always happy to hear that I didn't miss some completely obvious part of the docs that solves my problem. ;)

I will try your hacky suggestion. Incidentally, if you have any pointers about where to start implementing this properly in asv, I might have a crack at it!

@pv
Copy link
Collaborator

pv commented Jun 23, 2016 via email

@mrocklin
Copy link

cc @mike-wendt you might appreciate the hacky suggestion here

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

No branches or pull requests

3 participants