Enhance mem_usage_benches to more precisely measure peak memory usage
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- performance
Research direction
Start by locating the mem_usage_benches entry point and reviewing how its main function is run under Valgrind. Investigate how to isolate the stack and heap usage of sign_mu_deterministic from setup, constants, and print! overhead. Done means the benchmark reports a more precise peak memory measurement for the signing operation.
Written by the indexing model from the issue text.
Description
Currently, the memory usage benchmarks are structured like this:
fn main() {
bench_mldsa87_lowmemory_sign()
}
fn bench_mldsa87_lowmemory_sign() {
use bouncycastle::mldsa_lowmemory::{MLDSA87, MLDSA87_SK_LEN, MLDSA87PrivateKey, MLDSATrait};
eprintln!("MLDSA87_lowmemory/Sign");
let sk = MLDSA87PrivateKey::from_bytes(&[
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D,
0x1E, 0x1F,
])
.unwrap();
let msg = b"The quick brown fox jumped over the lazy dog";
let mu = MLDSA87::compute_mu_from_sk(&sk, msg, None).unwrap();
let sig = MLDSA87::sign_mu_deterministic(&sk, &mu, [0u8; 32]).unwrap();
print!("{:x?}", sig);
}
Then we run this main within valgrind to measure its peak memory usage.
The problem with this approach is that we are also measuring memory usage of main(), the seed and msg constants, and the two print! macros. (the prints, I think, are required to force the compiler not to elide the actual operations) For some algorithms like sha3, these overheads It would be more ideal to measure only the stack / heap memory usage of the ::signmu_deterministic(..), but I have no idea how to do this. Needs some research.
- Dominant language
- Rust
- Stars
- 25
- Forks
- 18
- Avg merge
- 16h 38m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bcgit/bc-rust
-
good first issue refactor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug team:backend track:services-maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cowprotocol/services#4950 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·