Skip to content

Benchmarking #2454

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

Merged
merged 1 commit into from
Aug 4, 2022
Merged

Benchmarking #2454

merged 1 commit into from
Aug 4, 2022

Conversation

benjeffery
Copy link
Member

WIP #2444

Needs some polish, but probably a good point to get early feedback on the direction. The results are appended to a JSON file that will be committed to the repo, and a very basic HTML report generated:

Screenshot from 2022-08-01 12-05-22

My thinking is that at under a minute we can add this to CI.

@benjeffery benjeffery marked this pull request as draft August 1, 2022 11:06
@jeromekelleher
Copy link
Member

Looks great!

Some unexpected differences here in the e.g. tree.parent_array, which make me wonder if anything under 50ns should just be "green". Do you think these are significant?

Re running in CI, I guess we just run it to make sure it hasn't broken but don't pay any attention to the numbers?

Probably worth spinning into its own Workflow, so we're not running it n-times in the Tests?

@codecov
Copy link

codecov bot commented Aug 1, 2022

Codecov Report

Merging #2454 (44e83aa) into main (4c4ca2c) will decrease coverage by 0.93%.
The diff coverage is n/a.

❗ Current head 44e83aa differs from pull request most recent head 7fa6187. Consider uploading reports for the commit 7fa6187 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2454      +/-   ##
==========================================
- Coverage   93.44%   92.51%   -0.94%     
==========================================
  Files          28       28              
  Lines       27380    27732     +352     
  Branches     1253     1350      +97     
==========================================
+ Hits        25584    25655      +71     
- Misses       1762     2040     +278     
- Partials       34       37       +3     
Flag Coverage Δ
c-tests 92.26% <ø> (ø)
lwt-tests 89.05% <ø> (ø)
python-c-tests 71.24% <ø> (+0.04%) ⬆️
python-tests 98.95% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
python/tskit/vcf.py 72.06% <0.00%> (-26.36%) ⬇️
python/tskit/trees.py 88.57% <0.00%> (-10.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c4ca2c...7fa6187. Read the comment docs.

@benjeffery
Copy link
Member Author

benjeffery commented Aug 1, 2022

Looks great!

Some unexpected differences here in the e.g. tree.parent_array, which make me wonder if anything under 50ns should just be "green". Do you think these are significant?

Yes, the colouring was a quick hack. I think for those fast ones that is usual variance.

Re running in CI, I guess we just run it to make sure it hasn't broken but don't pay any attention to the numbers?

Exactly, mostly run it to check we didn't break it, occasionally look at the numbers if useful.

Probably worth spinning into its own Workflow, so we're not running it n-times in the Tests?

Yeah, very simple action that will finish before all the other tests, so not making our CI longer in total.

@benjeffery benjeffery force-pushed the bench branch 2 times, most recently from 08fb3a8 to e9b106a Compare August 2, 2022 11:21
@benjeffery
Copy link
Member Author

Ok, this needs some docs, but is ready for a code review.
Here is the full table - there are a couple of regressions that might be worth looking into.
screencapture-file-home-benj-projects-tskit-python-benchmark-bench-results-html-2022-08-02-12_20_56

@benjeffery benjeffery marked this pull request as ready for review August 2, 2022 11:23
Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

The only major thing that's missing from the benchmarks is row-by-row access with/out metadata decoding, but we can add that in later.

@petrelharp
Copy link
Contributor

Wow!!!! This is great!

@benjeffery benjeffery force-pushed the bench branch 11 times, most recently from 0db6de8 to 5efe70b Compare August 2, 2022 21:38
@benjeffery
Copy link
Member Author

benjeffery commented Aug 2, 2022

I've added a test for decoding metadata. I've also added a script that runs the benchmarks across all released versions.
I've also added the script to CI (takes ~5m), the results are available as an artifact - they won't be directly comparable as it is a different CPU, but the relative changes should still be useful. I think this is ready to merge, it could be more polished, e.g. making the script a proper command line tool with args, but I don't think that is worth the dev time for the benefits currently.

I think we should keep an issue open for RAM benching.

@benjeffery
Copy link
Member Author

BTW, this shows how great the backwards compatibility has been. Same 0.5.2 file for all these benchmarks!

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Few minor suggestions, merge away whenever you're happy.

if __name__ == "__main__":
versions = [v for v in versions("tskit") if "a" not in v and "b" not in v]
for v in tqdm.tqdm(versions):
os.system(f"pip install tskit=={v}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's probably worth automating in a venv here, so that the devs environment doesn't get messed up by running this.

if __name__ == "__main__":
versions = [v for v in versions("tskit") if "a" not in v and "b" not in v]
for v in tqdm.tqdm(versions):
os.system(f"pip install tskit=={v}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subprocess.run(check=True, shell=True) is a better option here

return ret


def make_file():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly nicer:

benchfile = tskit_dir / "benchmark" / "bench.trees"
if not benchfile.exists():
     ...
     ts.dump(benchfile)

similar patterns below

@mergify mergify bot merged commit 46d3e4a into tskit-dev:main Aug 4, 2022
This was referenced Aug 4, 2022
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

Successfully merging this pull request may close these issues.

3 participants