OXYGENHUB
# c6e69e4b8d8f oxygen / vendor / crc-fast / .kiro / specs / checksum-benchmark-option / requirements.md
3.3 KiB · Markdown · last changed Strata: the cloud stores send through ureq, so every release target links 1 month ago renderedsource blame history raw
1
# Requirements Document
2
3
## Introduction
4
5
This feature adds a simple benchmark option to the existing `bin/checksum.rs` tool via a command-line flag. The benchmark will allow users to test performance across different platforms using a single binary, reporting throughput in GiB/s and the acceleration target used. This enables cross-platform performance comparison without requiring a full development environment checkout.
6
7
## Glossary
8
9
- **Checksum_Tool**: The existing `bin/checksum.rs` binary application
10
- **Benchmark_Mode**: A new operational mode that measures and reports performance metrics
11
- **Acceleration_Target**: The hardware-specific optimization path returned by `get_calculator_target()`
12
- **Throughput_Metric**: Performance measurement expressed in GiB/s (gibibytes per second)
13
- **Test_Data**: Randomly generated byte array used for benchmark measurements
14
- **Black_Box**: Rust's `std::hint::black_box()` function that prevents compiler optimizations during benchmarking
15
16
## Requirements
17
18
### Requirement 1
19
20
**User Story:** As a developer, I want to run performance benchmarks from the checksum tool, so that I can compare CRC performance across different hardware platforms without setting up a full development environment.
21
22
#### Acceptance Criteria
23
24
1. WHEN the user provides a `-b` flag, THE Checksum_Tool SHALL enter Benchmark_Mode
25
2. WHILE in Benchmark_Mode, THE Checksum_Tool SHALL generate Test_Data of the specified size once and reuse it for all iterations
26
3. THE Checksum_Tool SHALL report Throughput_Metric in GiB/s format
27
4. THE Checksum_Tool SHALL display the Acceleration_Target used for the benchmark
28
5. THE Checksum_Tool SHALL use Black_Box to prevent compiler optimizations during measurement
29
30
### Requirement 2
31
32
**User Story:** As a developer, I want to specify benchmark parameters, so that I can control the test conditions for consistent cross-platform comparisons.
33
34
#### Acceptance Criteria
35
36
1. WHEN the user provides `-a` parameter with `-b` flag, THE Checksum_Tool SHALL use the specified CRC algorithm for benchmarking
37
2. WHEN the user provides `--size` parameter, THE Checksum_Tool SHALL generate Test_Data of the specified byte size
38
3. WHEN the user provides `--duration` parameter, THE Checksum_Tool SHALL run the benchmark for the specified number of seconds
39
4. WHERE no benchmark parameters are provided, THE Checksum_Tool SHALL use default values of 1 MiB for size and 10 seconds for duration
40
5. THE Checksum_Tool SHALL validate all benchmark parameter values before starting the benchmark
41
42
### Requirement 3
43
44
**User Story:** As a developer, I want the benchmark to support both file/string input and generated data, so that I can benchmark with specific data or use random data for consistent testing.
45
46
#### Acceptance Criteria
47
48
1. WHEN the user provides `-b` with `-f` or `-s` flags, THE Checksum_Tool SHALL use the file or string content as Test_Data for benchmarking
49
2. WHEN the user provides `-b` with `--size` parameter but no `-f` or `-s` flags, THE Checksum_Tool SHALL generate random Test_Data of the specified size
50
3. IF the user provides `-b` without any data source or size specification, THEN THE Checksum_Tool SHALL generate random Test_Data using the default size
51
4. THE Checksum_Tool SHALL display appropriate usage information when benchmark parameters are invalid
52
5. THE Checksum_Tool SHALL maintain backward compatibility with existing checksum functionality