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 json output and make target for benchmarking layered store. #1146

Merged
merged 4 commits into from
Nov 20, 2020

Conversation

gs0510
Copy link
Contributor

@gs0510 gs0510 commented Nov 18, 2020

@icristescu suggested 2005 as the number of commits since every 1000 commits, a tree is committed and there's 2 freeze cycles so that time can also be taken into account, I'd be open to just using the default value as well.

@icristescu suggested 2005 as the number of commits since every 1000 commits, a
tree is committed and there's 2 freeze cycles so that time can also be taken into
account.
@@ -267,7 +267,31 @@ let run config =
Fmt.epr "After freeze thread finished : ";
FSHelper.print_size config.root)

let main () ncommits ncycles depth clear no_freeze show_stats =
type result = {
number_of_commits : int;
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is not very important to report on the benchmark outputs (as hopefully they should always stay the same? :-))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point!

@samoht
Copy link
Member

samoht commented Nov 18, 2020

Nice :-) Looking forward to see the benchmark results in action ;-)

@gs0510 gs0510 requested a review from icristescu November 19, 2020 09:24
CHANGES.md Outdated
@@ -21,6 +21,8 @@
- **irmin-bench** (_new_):
- Created a new package to contain benchmarks for Irmin and its various
backends. (#1142, @CraigFe)
- Added ability to get json output and a make target to tun layers benchmark.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Added ability to get json output and a make target to tun layers benchmark.
- Added ability to get json output and a make target to run layers benchmark.

CHANGES.md Outdated
@@ -189,7 +191,7 @@
for generating Irmin generics.

- **irmin-unix**:
- Added a `--hash` parameter to the command-line interface, allowing the hash
- Added a `--hash` parameter to the command-line interface, the hash
Copy link
Contributor

Choose a reason for hiding this comment

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

unintended change, I think

@@ -229,7 +229,7 @@ let first_5_cycles config repo =
print_commit_stats config c 0 0.0;
let rec aux i c =
add_min c;
if i >= 4 then Lwt.return c
if i > 4 then Lwt.return c
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only 4 cycles were running before, fixed to run 5 cycles as the function name suggests 😸

Copy link
Member

Choose a reason for hiding this comment

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

One day, we'll live in an Lwt utopia with helper functions for these things...

@gs0510 gs0510 requested review from icristescu and craigfe November 20, 2020 08:23
@@ -281,13 +302,15 @@ let main () ncommits ncycles depth clear no_freeze show_stats =
in
init config;
let d, _ = Lwt_main.run (with_timer (fun () -> run config)) in
let all_commits = ncommits * ncycles in
let all_commits = ncommits * (ncycles + 5) in
Copy link
Member

Choose a reason for hiding this comment

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

Seems odd to always run 5 more cycles than requested. Perhaps we could run max(5, ncycles) and update the CLI doc to say that at least 5 runs are necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first 5 cycles are run in addition to the number of cycles passed as arg.

https://github.com/mirage/irmin/blob/master/bench/irmin-pack/layers.ml#L263 runs the first 5 cycles followed by run_cycles. Maybe we should remove the first_5_cycles and change the doc to say running at least 5 is necessary?

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, I think it's better to have a more explicit behaviour.

Out of interest, why is it necessary to have at least 5 cycles? It seems that I might want to just run ~1 cycle when working on the benchmarks, for instance.

Copy link
Contributor Author

@gs0510 gs0510 Nov 20, 2020

Choose a reason for hiding this comment

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

I don't know! Paging @icristescu 😁

Copy link
Contributor

Choose a reason for hiding this comment

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

The benchmarks are meant to be somewhat similar to the tezos usecase where every freeze copies the last 5 cycles. So we need to have the first 5 cycles before calling the first freeze. Then each cycle we call freeze again (done by run_cycles). You are free to change the benchmarks, just I think the default behaviour should be this one (and more documentation is always welcomed:) )

Copy link
Member

Choose a reason for hiding this comment

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

Merge when ready then, @gs0510 🙂

let doc =
Arg.info
~doc:
"Number of cycles. This will be in addition to the 5 cycles that run \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this documentation here, hopefully it makes it clearer that it will be 5 + ncycles running. cc @craigfe @icristescu

@craigfe craigfe merged commit 546c5fe into mirage:master Nov 20, 2020
@craigfe
Copy link
Member

craigfe commented Nov 20, 2020

Thanks!

@samoht
Copy link
Member

samoht commented Nov 20, 2020

Does it mean that I can rebase my other PRs to see the benchmark results now?

@gs0510
Copy link
Contributor Author

gs0510 commented Nov 20, 2020

@samoht Sorry this will take one more day because I have to add a config to run make bench-layers instead of make bench for irmin 😬

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.

4 participants