benches: CRL parsing/searching benchmarks.#108
Conversation
Codecov Report
@@ Coverage Diff @@
## main #108 +/- ##
=======================================
Coverage 95.36% 95.36%
=======================================
Files 15 15
Lines 3346 3346
=======================================
Hits 3191 3191
Misses 155 155 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Hmm, I thought we fixed this by narrowing the check to the primary library crate.
If we want to merge this branch before |
b8baf6c to
96d3ffa
Compare
Dropping
Added a |
Are these results from before the hash-table change? I get these: |
I updated the comment when I rebased this branch on top of the reworked representation branch a few days ago. I can reproduce what you're seeing locally when I re-run the benchmarks from scratch today. Very odd because the benchmarks are using the |
|
Flipping this to a draft while I dig into what's going on with the search benchmark results. I thought maybe something was getting optimized out but adding a |
|
Ahhh! I think I figured it out. I had changed how I was populating the serial numbers in the revoked certs of the generated test CRLs. When I re-ran the benchmarks the other day to get new #'s I had CRLs already generated that used the previous approach and so the benchmarks ran against those. You generated new CRLs, and when I re-tested today I did the same. Those CRLs have some negative serial numbers and the linear search bails on the first invalid serial number, ending the search prematurely. I'll fix the serial number generation and also update the benchmark methods so that they ensure no errors were encountered in the search. Thanks for catching that. |
|
adding an edit: snap! |
Done and the benchmark times are back to what I was seeing before: |
|
@ctz Does the current revision benchmark correctly for you locally? You will need to delete the |
|
Yep, just retested with a96b124 and I got reasonable figures. |
|
Worth extending these to show the difference with the owned types? |
This commit adds two kinds of CRL benchmark tests: 1. Parsing benchmarks, testing how long it takes to use `BorrowedCertRevocationList::from_der`, as well as how long it takes to do the same converting to the `OwnedCertRevocationList` representation that allocates. 2. Searching benchmarks, testing how long it takes to search an already parsed CRL for a serial number that doesn't appear in the CRL. This is done for both the borrowed and owned representations. In both cases we add benchmarks that use three sizes of CRLs: 1. a small CRL (2,000 serials, ~72kb) 2. a medium CRL (600,000 serials, ~22mb) 3. a large CRL (1,500,000 serials, ~50mb) Since large test files aren't suitable for inclusion in git, these CRLs are generated on first benchmark run using `rcgen`. We use a Cargo patch to use the master branch of this dev-dependency for CRL support. Initial results from my laptop: ``` Running benches/benchmark.rs (target/release/deps/benchmarks-b6e36ee32c803b65) running 12 tests test bench_parse_borrowed_crl_large ... bench: 49 ns/iter (+/- 12) test bench_parse_borrowed_crl_medium ... bench: 51 ns/iter (+/- 4) test bench_parse_borrowed_crl_small ... bench: 53 ns/iter (+/- 1) test bench_parse_owned_crl_large ... bench: 502,094,511 ns/iter (+/- 106,915,574) test bench_parse_owned_crl_medium ... bench: 183,980,410 ns/iter (+/- 10,231,635) test bench_parse_owned_crl_small ... bench: 188,714 ns/iter (+/- 9,487) test bench_search_borrowed_crl_large ... bench: 42,466,919 ns/iter (+/- 4,490,349) test bench_search_borrowed_crl_medium ... bench: 16,940,885 ns/iter (+/- 823,770) test bench_search_borrowed_crl_small ... bench: 53,643 ns/iter (+/- 7,362) test bench_search_owned_crl_large ... bench: 10 ns/iter (+/- 4) test bench_search_owned_crl_medium ... bench: 9 ns/iter (+/- 2) test bench_search_owned_crl_small ... bench: 10 ns/iter (+/- 1) test result: ok. 0 passed; 0 failed; 0 ignored; 12 measured ``` Laptop specs: * rustc 1.69.0 * NixOS 22.11 * 12th Gen Intel(R) Core(TM) i7-1280P * 32GB DDR4-3200 * WD_BLACK SN850 NVMe
Done 👍 Also updated the PR description with fresh results. |
This branch adds two kinds of CRL benchmark tests:
BorrowedCertRevocationList::from_der, as well as how long it takes to do the same converting to theOwnedCertRevocationListrepresentation that allocates.In both cases we add benchmarks that use three sizes of CRLs:
Since large test files aren't suitable for inclusion in git, these CRLs are generated on first benchmark run using
rcgen. We use a Cargo patch to use the master branch of this dev-dependency for CRL support.Initial results from my laptop:
Laptop specs: