Skip to content

⚡ Bolt: Optimize write_match_fast and fix CRC32 benchmark#237

Merged
404Setup merged 1 commit intomainfrom
perf/write-match-fast-17350663453863150625
Feb 19, 2026
Merged

⚡ Bolt: Optimize write_match_fast and fix CRC32 benchmark#237
404Setup merged 1 commit intomainfrom
perf/write-match-fast-17350663453863150625

Conversation

@404Setup
Copy link
Copy Markdown
Owner

💡 What:

  1. Optimized write_match_fast in src/compress/mod.rs by combining the bitstream writes for match length and offset when their combined bit count is <= 32. This reduces the number of bitcount checks and buffer stores.
  2. Fixed the crc32_slice8 benchmark in benches/bench_main.rs by wrapping the input data in std::hint::black_box.

🎯 Why:

  1. Bitstream writing is a hot path for fast compression levels (e.g., Level 1), especially for small files where matches are short. Reducing overhead here improves throughput.
  2. The crc32_slice8 benchmark was reporting impossibly high throughput (27 TiB/s) because the compiler was hoisting the pure function call out of the loop (Loop Invariant Code Motion). black_box prevents this.

📊 Impact:

  • Improves Level 1 compression throughput for small inputs (e.g., 1KB) by ~2.4% (205 MiB/s -> 210 MiB/s).
  • Ensures crc32_slice8 benchmark reports realistic numbers (~1.3 GiB/s) for future optimization work.

🔬 Measurement:

  • cargo bench --bench bench_main "Compress/libdeflate-rs XXS Level 1"
  • cargo bench --bench bench_main "CRC32 Slice8"

PR created automatically by Jules for task 17350663453863150625 started by @404Setup

@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@404Setup 404Setup merged commit bbe8091 into main Feb 19, 2026
1 check passed
@404Setup 404Setup deleted the perf/write-match-fast-17350663453863150625 branch February 19, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant