⚡ Optimize high concurrency tests by avoiding Vec cloning - #137
Conversation
Replaced `Vec<u8>` with `std::sync::Arc<[u8]>` in `tests/high_concurrency.rs` for `PartialReader` and `run_worker` to prevent expensive cloning of the underlying data inside high-concurrency testing loops. Co-authored-by: panayang <223123845+panayang@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Fixed rustfmt failure in `tests/high_concurrency.rs` by correctly applying formatting to the Arc initialization.
Applied `cargo fmt --all` across the repository to satisfy CI format checks.
💡 What: Replaced
Vec<u8>withstd::sync::Arc<[u8]>in the high concurrency benchmarks (PartialReaderandrun_worker).🎯 Why: The test previously spawned 5 million tasks, cloning a
Vec<u8>for each one. This was inefficient. By usingArc<[u8]>, the clones only copy an atomic pointer and increment a reference count, significantly reducing allocation and memory-copying overhead.📊 Measured Improvement:
In
test_high_concurrency: ~554,251 tasks/sec -> ~724,207 tasks/sec (30.6% improvement).In
test_high_concurrency_no_batching: ~195,141 tasks/sec -> ~225,937 tasks/sec (15.7% improvement).PR created automatically by Jules for task 7404572979866394443 started by @panayang