Skip to content

Commit

Permalink
Merge #239: benchmarks: updates and cleanups
Browse files Browse the repository at this point in the history
5ee4bf5 benches: run each benchmark 5 times (Andrew Poelstra)
6a80cd5 benches: output a bunch more data when doing `cargo run` (Andrew Poelstra)
4bf0e9a benches: add rest of new jets (Andrew Poelstra)
08008f0 benches: add total_fee and output_is_fee jets (Andrew Poelstra)
1eb9db3 benches: refactor value handling and sampling logic for core jets (Andrew Poelstra)
a13ff9d benches: refactor tx environment sampling (Andrew Poelstra)
73baa0f benches: check that all jets are actually benchmarked (Andrew Poelstra)
4505bf6 benches: move supporting functionality into library (Andrew Poelstra)
ca1db02 benches: run cargo fmt (Andrew Poelstra)
da3c282 benches: run clippy (Andrew Poelstra)

Pull request description:

  This significantly improves and cleans up the benchmarks. This branch was used to generate the data for BlockstreamResearch/simplicity#247.

  The main changes are:

  * Refactors transaction environment sampling to be more extensible; extends it with the ability to create lots of fee outputs.
  * Replaces the recursive `Value` logic for input/output buffers with a new custom `FlatValue` type which uses flat arrays and should be much cleaner.
  * Writes new faster/correct samplers for the `FlatValue` type which can call into libsimplicity to do things like computing valid ges (without doing a pubkey multiplication) and computing valid gejs (which previously was just impossible)
  * Rewrites the sampling traits to support multiple distributions; runs the benchmarks with different distributions to find the best/worst ones rather than repeatedly benchmarking with adhoc data.

  For the transaction environment jets, which include all the transaction intropection jets, this makes minimal changes. A future PR should do something similar for the transaction environment, running multiple benchmarks across multiple distributions. But because these jets are implemented as lookups into a compute-once-per-tx transaction environment structure, I expect their cost to be very low and low-variance, so I did not do this work.

ACKs for top commit:
  uncomputable:
    ACK 5ee4bf5 Love the `InputSample` trait and the combination of multiple samples into a bigger sample.

Tree-SHA512: d0903fb08e839e4351785f484068b4ed8f25134a983a60a46d8a60f21cb2ff37a5ac5c32ac812d91f19f898d7b8e381b80aae4e66fe6b2125d89e749967c653f
  • Loading branch information
uncomputable committed Jul 26, 2024
2 parents c74f94d + 5ee4bf5 commit bd19efa
Show file tree
Hide file tree
Showing 12 changed files with 2,175 additions and 599 deletions.
8 changes: 7 additions & 1 deletion jets-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ version = "0.1.0"
edition = "2021"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "simplicity_bench"
path = "src/lib.rs"

[[bin]]
name = "main"
path = "src/main.rs"

[dependencies]
serde_cbor = "0.11.1"
Expand Down
95 changes: 0 additions & 95 deletions jets-bench/benches/elements/input.rs

This file was deleted.

Loading

0 comments on commit bd19efa

Please sign in to comment.