OXYGENHUB
# 51d4862a16d8 oxygen / vendor / crc-fast / .kiro / specs / checksum-benchmark-option / tasks.md
2.5 KiB · Markdown · last changed Strata: the cloud stores send through ureq, so every release target links 1 month ago renderedsource blame history raw
1
# Implementation Plan
2
3
- [x] 1. Extend command line argument parsing for benchmark options
4
  - Add `-b` flag to enable benchmark mode in the argument parser
5
  - Add `--size` parameter for specifying random data size
6
  - Add `--duration` parameter for benchmark duration (floating-point seconds)
7
  - Update the `Config` struct to include optional `BenchmarkConfig`
8
  - Update usage/help text to include new benchmark options
9
  - _Requirements: 1.1, 2.1, 2.2, 2.3, 2.4_
10
11
- [x] 2. Implement benchmark data structures and validation
12
  - Create `BenchmarkConfig` struct with size and duration fields
13
  - Create `BenchmarkData` enum to handle in-memory vs file data sources
14
  - Create `BenchmarkRunner` struct with algorithm, data, and duration
15
  - Create `BenchmarkResult` struct with all metrics including time per iteration
16
  - Add validation logic for benchmark parameters (positive values)
17
  - _Requirements: 2.5, 3.4_
18
19
- [x] 3. Implement benchmark execution logic
20
  - Create benchmark runner with timing loop using `std::time::Instant`
21
  - Implement separate execution paths for in-memory data vs file data
22
  - Use `std::hint::black_box()` to prevent compiler optimizations
23
  - Calculate throughput in GiB/s and time per iteration with appropriate units
24
  - Integrate `get_calculator_target()` for acceleration target reporting
25
  - _Requirements: 1.2, 1.3, 1.4, 1.5_
26
27
- [x] 4. Implement data source handling
28
  - Add random data generation function using `rand::RngCore::fill_bytes()`
29
  - Implement logic to determine data source (file, string, or generated)
30
  - Handle file size detection for throughput calculations
31
  - Create `BenchmarkData` instances based on user input
32
  - _Requirements: 3.1, 3.2, 3.3_
33
34
- [x] 5. Integrate benchmark mode into main application flow
35
  - Modify main function to detect benchmark mode and route accordingly
36
  - Ensure mutual exclusivity validation between benchmark and normal modes
37
  - Add benchmark result formatting and display
38
  - Update error handling to include benchmark-specific errors
39
  - Maintain backward compatibility with existing functionality
40
  - _Requirements: 3.4, 3.5_
41
42
- [x] 6. Add comprehensive testing for benchmark functionality
43
  - Write unit tests for argument parsing with benchmark flags
44
  - Test benchmark parameter validation (invalid sizes, durations)
45
  - Test data source selection logic (file vs string vs generated)
46
  - Test benchmark execution with different algorithms
47
  - Verify throughput calculation accuracy
48
  - Test error handling for invalid benchmark configurations
49
  - _Requirements: All requirements_