Skip to content

fix(encoding): implement default compression level#34

Merged
polaz merged 9 commits intomainfrom
feat/#5-default-compression-level
Mar 26, 2026
Merged

fix(encoding): implement default compression level#34
polaz merged 9 commits intomainfrom
feat/#5-default-compression-level

Conversation

@polaz
Copy link
Copy Markdown
Member

@polaz polaz commented Mar 26, 2026

Summary

  • implement a dedicated dfast-style matcher for CompressionLevel::Default with a 4 MB window, dual hash tables, repeat-offset checks, and lazy match selection
  • keep CompressionLevel::Fastest on the original simple matcher so Default now meaningfully improves compression ratio instead of aliasing Fastest
  • fix the upper-range encode_match_len() base value bug that surfaced once the new matcher started emitting long matches

Testing

  • cargo nextest run --workspace
  • cargo build --workspace
  • cargo nextest run -p structured-zstd -E 'test(default_level_beats_fastest_on_corpus_proxy) or test(default_level_stays_within_ten_percent_of_ffi_level3_on_corpus_proxy)'

Notes

  • The ratio guard is verified against the repository corpus proxy (zstd/decodecorpus_files/z000033) and keeps Default within 10% of system zstd -3 on that input.
  • The original issue mentions the Silesia corpus specifically; that dataset is not stored in this repository, so this PR uses the in-repo corpus proxy plus full roundtrip / FFI interop coverage.

Closes #5

Summary by CodeRabbit

  • New Features

    • Added a new dfast-style match backend; Default compression level now uses it for improved speed/ratio.
  • Bug Fixes

    • Fixed match-length encoding for the 65,539–131,074 range.
  • Documentation

    • Updated Default compression level docs to describe its behavior.
  • Tests

    • Added roundtrip, cross-validation, and backend-initialization tests for the default level.

Copilot AI review requested due to automatic review settings March 26, 2026 06:23
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

Warning

Rate limit exceeded

@polaz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 3 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 80e5755a-eb23-4a0c-9a7f-0a71060c6421

📥 Commits

Reviewing files that changed from the base of the PR and between 3595e8f and 7bb70c8.

📒 Files selected for processing (2)
  • zstd/src/encoding/blocks/compressed.rs
  • zstd/src/encoding/match_generator.rs
📝 Walkthrough

Walkthrough

Added a DFAST-style matcher and wired CompressionLevel::Default to use it via the match-generator driver; fixed a match-length encoding boundary, expanded an offset helper's visibility, updated docs, and added unit/integration tests validating Default-level roundtrips and corpus comparisons.

Changes

Cohort / File(s) Summary
Compression dispatch
zstd/src/encoding/frame_compressor.rs
CompressionLevel::Default no longer falls through to unimplemented!(); it is routed to the matcher/backend selection (handled like the Fastest path at callsite).
Match generator & backends
zstd/src/encoding/match_generator.rs
Introduces DfastMatchGenerator and updates MatchGeneratorDriver to accept level: CompressionLevel, map level→(backend, slice_size, max_window_size), lazily initialize the dfast backend, and dispatch window_size, get_last_space, commit_space, start_matching, and skip_matching to the selected backend. Adds dfast-focused unit tests.
Docs
zstd/src/encoding/mod.rs
Rewrote the CompressionLevel::Default Rustdoc to describe that it uses the crate’s dfast-style matcher and targets a different speed/ratio tradeoff than Fastest.
Block encoding & offset helper
zstd/src/encoding/blocks/compressed.rs
Corrected encode_match_len base for the 65539..=131074 range; changed encode_offset_with_history visibility to pub(crate) and added a unit test validating the corrected match-length encoding.
Tests — Default-level roundtrip & cross-validation
zstd/src/tests/roundtrip_integrity.rs, zstd/tests/cross_validation.rs
Added roundtrip_default helper and tests that compress with CompressionLevel::Default and assert exact decompression; added corpus-proxy comparisons asserting Default beats Fastest on size and stays within 10% of FFI zstd level 3 on a fixed corpus.
Tests — dfast matcher
zstd/src/encoding/match_generator.rs (test module)
Added tests for DfastMatchGenerator covering multi-block roundtrip patterns, backend switching/initialization behavior, window eviction/skip semantics, and tail insertion for cross-block matching.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Driver as MatchGeneratorDriver
  participant Simple as MatchGenerator
  participant Dfast as DfastMatchGenerator

  Client->>Driver: reset(level)
  alt level selects Dfast
    Driver->>Dfast: init_if_needed(), set slice_size/max_window_size
    Client->>Driver: start_matching(data)
    Driver->>Dfast: start_matching(...)
    Dfast->>Driver: emit Sequence(s)
  else level selects Simple
    Driver->>Simple: set slice_size/max_window_size
    Client->>Driver: start_matching(data)
    Driver->>Simple: start_matching(...)
    Simple->>Driver: emit Sequence(s)
  end
  Driver->>Client: sequences / matches
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Poem

🐰 I hopped through hashes, slices, and streams,
Default woke up from unimplemented dreams.
Dfast finds matches, windows trim and slide,
Tests nod yes — bytes return inside.
🥕 Carrot-code victory, twitching with pride.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 65.45% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title directly describes the main implementation effort to add a functioning default compression level, matching the core objective.
Linked Issues check ✅ Passed All coding requirements from issue #5 are met: dfast matcher replaces panic, double hash tables implemented, 4MB window used, rep-code optimization included, match-length counting with 8-byte bulk comparison added, lazy evaluation implemented, and wired into CompressionLevel::Default.
Out of Scope Changes check ✅ Passed All changes are scoped to #5 requirements: DfastMatchGenerator implementation, frame_compressor wiring, match_generator dispatch logic, encode_match_len bugfix revealed by new matcher, and roundtrip/interop tests validating acceptance criteria.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#5-default-compression-level

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 93.95018% with 34 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
zstd/src/encoding/match_generator.rs 93.82% 34 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements support for CompressionLevel::Default by routing it through the existing encoder (instead of panicking), configuring the matcher/window for Default-level frames, and adding regression tests for Rust↔C zstd roundtrip/interop.

Changes:

  • Route CompressionLevel::Default through the existing compress_fastest path.
  • Configure the match generator to use a larger window for Default-level frames.
  • Add regression tests for Default-level roundtrip and Rust-compress→C-decompress interop.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
zstd/src/encoding/frame_compressor.rs Treat Default the same as Fastest during block compression.
zstd/src/encoding/match_generator.rs Adjust matcher reset behavior to configure slice/window sizing for Default.
zstd/src/encoding/mod.rs Remove “UNIMPLEMENTED” marker from CompressionLevel::Default docs.
zstd/src/tests/roundtrip_integrity.rs Add a Default-level roundtrip regression test/helper.
zstd/tests/cross_validation.rs Add Rust Default-compress → C zstd decompress regression coverage.
Comments suppressed due to low confidence (1)

zstd/src/encoding/frame_compressor.rs:204

  • CompressionLevel::Default is now handled by compress_fastest, which is documented elsewhere as level-1-ish. This makes the CompressionLevel::Default docs (“roughly equivalent to Zstd level 3”) and the PR/issue intent potentially misleading. Either update the documentation/PR scope to reflect that Default currently reuses the Fastest encoder with a larger window, or introduce a distinct Default implementation so the semantic contract matches the docs.
                }
                CompressionLevel::Fastest | CompressionLevel::Default => {
                    compress_fastest(&mut self.state, last_block, uncompressed_data, output)
                }
                _ => {
                    unimplemented!();
                }

Comment thread zstd/src/encoding/match_generator.rs
Comment thread zstd/src/encoding/match_generator.rs Outdated
Comment thread zstd/src/encoding/match_generator.rs Outdated
Comment thread zstd/src/tests/roundtrip_integrity.rs
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@zstd/src/encoding/match_generator.rs`:
- Around line 39-45: The match in configure_for_level sets
match_generator.max_window_size using a wildcard arm which silently applies the
slice_size to Uncompressed, Fastest, and any future CompressionLevel variants;
update configure_for_level to match CompressionLevel explicitly (e.g., handle
Default, Uncompressed, Fastest) and remove the broad `_` arm so the compiler
will force you to decide window sizes for new variants—either assign the
intended window or add an explicit unreachable/panic with a comment if a variant
should never reach the matcher—referencing configure_for_level and
match_generator.max_window_size to locate the change.

In `@zstd/src/tests/roundtrip_integrity.rs`:
- Around line 200-204: Add a new test that exercises multi-block compression for
CompressionLevel::Default by generating compressible data larger than 128KB
(e.g., 256KB or 512KB) using generate_compressible(...) and asserting roundtrip
equality with roundtrip_default(&data); name it something like
roundtrip_default_multi_block to complement roundtrip_default_level_regression
so window/block-boundary behavior is covered.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1eabad60-a5ad-48d5-a434-8ac6ec83e75c

📥 Commits

Reviewing files that changed from the base of the PR and between 1c9c616 and 15fee53.

📒 Files selected for processing (5)
  • zstd/src/encoding/frame_compressor.rs
  • zstd/src/encoding/match_generator.rs
  • zstd/src/encoding/mod.rs
  • zstd/src/tests/roundtrip_integrity.rs
  • zstd/tests/cross_validation.rs
💤 Files with no reviewable changes (1)
  • zstd/src/encoding/mod.rs

Comment thread zstd/src/encoding/match_generator.rs Outdated
Comment thread zstd/src/tests/roundtrip_integrity.rs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread zstd/src/encoding/mod.rs Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@zstd/src/encoding/match_generator.rs`:
- Around line 42-50: The match in level_config currently returns identical
(self.base_slice_size, self.base_window_size) for every CompressionLevel
variant; leave the explicit arms but add a concise inline comment above or
beside the match (or above the repeated arm block) stating that all arms
intentionally return the same values for now and that explicit arms are kept to
force future reviewers to make an intentional choice when new CompressionLevel
variants are added; reference the level_config method and the CompressionLevel
variants (Uncompressed, Fastest, Default, Better, Best) so the intent is clear
to future contributors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 696d85d0-deb6-4cab-963b-f5825d8048be

📥 Commits

Reviewing files that changed from the base of the PR and between 15fee53 and 13b33bd.

📒 Files selected for processing (3)
  • zstd/src/encoding/match_generator.rs
  • zstd/src/encoding/mod.rs
  • zstd/src/tests/roundtrip_integrity.rs

Comment thread zstd/src/encoding/match_generator.rs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread zstd/src/encoding/match_generator.rs Outdated
@polaz polaz force-pushed the feat/#5-default-compression-level branch from 06bd5d2 to 6c50fea Compare March 26, 2026 15:42
@polaz polaz requested a review from Copilot March 26, 2026 15:44
Copy link
Copy Markdown

@sw-release-bot sw-release-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'structured-zstd vs C FFI'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.15.

Benchmark suite Current: 6c50fea Previous: 98894d0 Ratio
compress/pure_rust/fastest 38.135 ms 18.51 ms 2.06

This comment was automatically generated by workflow using github-action-benchmark.

CC: @polaz

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@zstd/src/encoding/match_generator.rs`:
- Around line 546-601: start_matching currently clears short_hash and long_hash
then calls seed_history_tables over the entire concatenated window each time a
block is processed, which causes repeated reseeding and CPU work; change it to
maintain hash tables incrementally by removing the full clear/seed workflow and
instead only insert positions for newly appended bytes (use insert_position /
insert_positions) and update seed_history_tables or an incremental seeding
helper for the new block range so you avoid reprocessing the whole window; keep
start_matching, seed_history_tables, short_hash, long_hash, insert_position, and
insert_positions as anchors when refactoring so the logic that previously
cleared and reseeded can be replaced with incremental updates for the appended
block.
- Around line 698-727: The long_candidates loop lacks the same guard as
short_candidates against candidate_pos >= abs_pos; add an explicit skip in the
long_candidates iteration (before computing common_prefix_len) similar to the
short_candidates loop so candidate_pos >= abs_pos continues to the next
candidate, then proceed to compute match_len, call extend_backwards, update best
via Self::better_candidate, and keep the early-return when best.match_len >=
DFAST_TARGET_LEN; this ensures long_candidates behaves safely like
short_candidates and prevents invalid comparisons even if seeding produces a
non-decreasing position.

In `@zstd/tests/cross_validation.rs`:
- Around line 208-220: Update the documentation in mod.rs to correct the
statement that Default uses the same encoder path and matcher configuration as
Fastest: change the wording to state that CompressionLevel::Default uses
MatcherBackend::Dfast (see match_generator.rs) while CompressionLevel::Fastest
uses MatcherBackend::Simple, so they do not share the same matcher backend; keep
the rest of the doc intact and reference the two backends by name
(MatcherBackend::Dfast and MatcherBackend::Simple) for clarity.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 154cbc1c-09a4-4ca6-9e34-6b540e6a1a40

📥 Commits

Reviewing files that changed from the base of the PR and between 06bd5d2 and 6c50fea.

📒 Files selected for processing (6)
  • zstd/src/encoding/blocks/compressed.rs
  • zstd/src/encoding/frame_compressor.rs
  • zstd/src/encoding/match_generator.rs
  • zstd/src/encoding/mod.rs
  • zstd/src/tests/roundtrip_integrity.rs
  • zstd/tests/cross_validation.rs

Comment thread zstd/src/encoding/match_generator.rs
Comment thread zstd/src/encoding/match_generator.rs Outdated
Comment thread zstd/tests/cross_validation.rs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Comment thread zstd/src/encoding/match_generator.rs Outdated
Comment thread zstd/tests/cross_validation.rs
Comment thread zstd/tests/cross_validation.rs
Comment thread zstd/src/encoding/mod.rs Outdated
Comment thread zstd/src/encoding/match_generator.rs Outdated
Comment thread zstd/src/encoding/match_generator.rs
Comment thread zstd/src/encoding/match_generator.rs
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{"name":"HttpError","status":500,"request":{"method":"PATCH","url":"https://api.github.com/repos/structured-world/structured-zstd/issues/comments/4132024117","headers":{"accept":"application/vnd.github.v3+json","user-agent":"octokit.js/0.0.0-development octokit-core.js/7.0.6 Node.js/24","authorization":"token [REDACTED]","content-type":"application/json; charset=utf-8"},"body":{"body":"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- This is an auto-generated comment: review paused by coderabbit.ai -->\n\n> [!NOTE]\n> ## Reviews paused\n> \n> It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the `reviews.auto_review.auto_pause_after_reviewed_commits` setting.\n> \n> Use the following commands to manage reviews:\n> - `@coderabbitai resume` to resume automatic reviews.\n> - `@coderabbitai review` to trigger a single review.\n> \n> Use the checkboxes below for quick actions:\n> - [ ] <!-- {\"checkboxId\": \"7f6cc2e2-2e4e-497a-8c31-c9e4573e93d1\"} --> ▶️ Resume reviews\n> - [ ] <!-- {\"checkboxId\": \"e9bb8d72-00e8-4f67-9cb2-caf3b22574fe\"} --> 🔍 Trigger review\n\n<!-- end of auto-generated comment: review paused by coderabbit.ai -->\n\n<!-- walkthrough_start -->\n\n<details>\n<summary>📝 Walkthrough</summary>\n\n## Walkthrough\n\n`CompressionLevel::Default` is now routed to an implemented matcher path; a new `DfastMatchGenerator` backend and level-driven dispatch were added to the match-generator driver. Documentation and multiple unit/integration tests for Default-level behavior and encoding fixes were also introduced.\n\n## Changes\n\n|Cohort / File(s)|Summary|\n|---|---|\n|**Compression dispatch** <br> `zstd/src/encoding/frame_compressor.rs`|`CompressionLevel::Default` now dispatches along the implemented fastest/dfast path instead of falling through to `unimplemented!()`.|\n|**Match generator & backends** <br> `zstd/src/encoding/match_generator.rs`|Adds `DfastMatchGenerator`; `MatchGeneratorDriver::reset` now accepts `level: CompressionLevel`, selects backend and window/slice parameters, initializes `dfast_match_generator` lazily, and routes matching APIs to the active backend. Includes new unit test for multi-block dfast matching.|\n|**Block encoding & offset helper** <br> `zstd/src/encoding/blocks/compressed.rs`|Fixed `encode_match_len` upper-range base value; changed `encode_offset_with_history` visibility to `pub(crate)`; added unit test validating the corrected encoding.|\n|**Docs** <br> `zstd/src/encoding/mod.rs`|Updated doc comment for `CompressionLevel::Default` to describe it as the crate’s dfast-style default matcher and removed placeholder “UNIMPLEMENTED” note.|\n|**Tests — Default-level roundtrip** <br> `zstd/src/tests/roundtrip_integrity.rs`|Added `roundtrip_default` helper and two regression tests asserting compress→decompress roundtrip fidelity for `CompressionLevel::Default`.|\n|**Tests — cross-validation / corpus comparisons** <br> `zstd/tests/cross_validation.rs`|Added tests that validate FFI decompression interoperability and assert `Default` produces smaller output than `Fastest` and stays within 10% of FFI level 3 on a corpus proxy.|\n\n## Sequence Diagram(s)\n\n```mermaid\nsequenceDiagram\n  participant Client\n  participant Driver as MatchGeneratorDriver\n  participant Simple as MatchGenerator\n  participant Dfast as DfastMatchGenerator\n\n  Client->>Driver: reset(level)\n  alt level selects Dfast\n    Driver->>Dfast: reset(level, slice_size, max_window_size)\n    Driver->>Dfast: insert_position / start_matching(...)\n    Dfast->>Driver: Sequence(s)\n  else level selects Simple\n    Driver->>Simple: reset(level)\n    Driver->>Simple: start_matching(...)\n    Simple->>Driver: Sequence(s)\n  end\n  Driver->>Client: sequences / matches\n```\n\n## Estimated code review effort\n\n🎯 4 (Complex) | ⏱️ ~45 minutes\n\n## Possibly related issues\n\n- `#5`: feat: implement Default compression level (zstd level 3, dfast strategy) — This PR implements a dfast-style matcher and removes the `unimplemented!()` behavior for `CompressionLevel::Default`, addressing the issue's main objective.\n- structured-world/structured-zstd#6 — The match-generator driver and `DfastMatchGenerator` additions align with requests to support additional match backends and level-driven configuration used by other level implementations.\n\n## Poem\n\n> 🐰 I hopped through hashes, windows, and flight,  \n> Default found rails and now compresses right.  \n> Slices stitched, tests give a cheer,  \n> Bytes rewind—no panic here.  \n> Carrots for code, a rabbit’s delight 🥕\n\n</details>\n\n<!-- walkthrough_end -->\n\n\n<!-- pre_merge_checks_walkthrough_start -->\n\n<details>\n<summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary>\n\n### ❌ Failed checks (1 warning)\n\n|     Check name     | Status     | Explanation                                                                           | Resolution                                                                         |\n| :----------------: | :--------- | :------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------- |\n| Docstring Coverage | ⚠️ Warning | Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |\n\n<details>\n<summary>✅ Passed checks (4 passed)</summary>\n\n|         Check name         | Status   | Explanation                                                                                                                                                                                                             |\n| :------------------------: | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n|      Description Check     | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled.                                                                                                                                                             |\n|         Title check        | ✅ Passed | The title 'fix(encoding): implement default compression level' clearly summarizes the main change: implementing the CompressionLevel::Default variant that previously panicked.                                         |\n|     Linked Issues check    | ✅ Passed | The PR successfully implements all coding requirements from issue `#5`: dfast-style matcher with dual hash tables, 4MB window, repeat offset checks, lazy match selection, and passing roundtrip and C-FFI interop tests. |\n| Out of Scope Changes check | ✅ Passed | All changes align with issue `#5` objectives. The encode_match_len fix is a legitimate bug exposed by long matches from the new matcher and is directly scoped to support the implementation.                             |\n\n</details>\n\n<sub>✏️ Tip: You can configure your own custom pre-merge checks in the settings.</sub>\n\n</details>\n\n<!-- pre_merge_checks_walkthrough_end -->\n\n<!-- finishing_touch_checkbox_start -->\n\n<details>\n<summary>✨ Finishing Touches</summary>\n\n<details>\n<summary>📝 Generate docstrings</summary>\n\n- [ ] <!-- {\"checkboxId\": \"7962f53c-55bc-4827-bfbf-6a18da830691\"} --> Create stacked PR\n- [ ] <!-- {\"checkboxId\": \"3e1879ae-f29b-4d0d-8e06-d12b7ba33d98\"} --> Commit on current branch\n\n</details>\n<details>\n<summary>🧪 Generate unit tests (beta)</summary>\n\n- [ ] <!-- {\"checkboxId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Create PR with unit tests\n- [ ] <!-- {\"checkboxId\": \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Commit unit tests in branch `feat/#5-default-compression-level`\n\n</details>\n\n</details>\n\n<!-- finishing_touch_checkbox_end -->\n\n<!-- tips_start -->\n\n---\n\n\n\n<sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub>\n\n<!-- tips_end -->\n\n<!-- internal state start -->\n\n\n<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKPR1AGxJcAZvAAeABRkTLTwGEQAlFzwzNxebBi4kEo+aNgeyUxxFNKI8PhYXlIekIG2kGYAzAAskZBykNiIlDz4HmgAXpCAKAT2+NgUDCQNVBgMsJA+JNQA9GYArGCp6Zlg2bx5BRhgxSSlgEmEkMzaGBqQAMq41M1c+Nxk5wDCudR0XABMAAwfAGxgXyqYD+0C+vw4HyqHAWAHYAFrPDz4FrIRbnACqNgAMlxYLhcNxEBxZrMiOpYNgBBpsrNELgKNgxIM6GAAO74CgeWi0+mM3DM2hgTp07ncDIeWa1IxPWCYUjIQJpMTIHwUFjWOxKRAMCjwbjiQrRAxQACScQS7HQKTo8AYb3otDSdLAdNkXmO1AmrR8HMgTxYm0Q+UKWJIJQ4HAAIiQ0hlkqzyVaapAALIAIUgCYwtHwrIANClsGhSrLEJNrgIvIgC7kHtQwPgfD4WllYKIANbV9DZyAdTryE64Cb2faiA1nY3WXItChSP0B6fBjCh8McABiaDp0mShUguDb/F1ZIwxfssXiI0HXr4iHwkGjscykAwd6REVaxfgm+kkA3W7pGiTmuATdk03APBQYBjKQkAhIoJAAPpXrACFeBggT1AI35gBIxbYCMAjYEQsH+NwyJ0A08hvsRyE/iQzDqDQ9CNPuIzkKyHpDm2FCAVA0DbsgDJYAm+6MM4RB3uQ/g0HS3b0HaFASQ02DwFyADc9gPAw8B+Awe4CSRlDaS0tBcCsca7GG+yQBIyB/jJySYPQD6rMktm/muJq9lZpRVPwWCsZAtbIuoHLyEwFBisgvD4P4si8ZANjUAUkBEEWFCmfeMauZA7YkPqmbkuEkAAIxfAApPwPj2LIW7MJAwq4PQYB+bugXBQokXNDwapxW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gE2yGz4ecAnaabKErmyHZQPUgbQBdmoDTEg9IMObGRn08l+1RNGcvzbCLxYZgMoHhDBWrpILgTAB4H6BVpVzR5QPfGQdOAEd8/ZpMoGQ4Rjm3zPw3WTSeQJGCLACUPMU7NIFtIjAI2JRNCFMBAioBNYXgMkGBXDiERiIk5GFo0Ejj6T1WgUPhH7C+ioAwgSheelfOxLf4c2QcS5O/k8b3z/p8ETWc4FBlULx5k83IEbOfl28550Mw+e2GPkYCvkEMHwJfKCzit3wiAdeSiHLzsBt51RXeZAH3l6p7ZJ8vVI32DEk9lApAKhY/OnnGzfZKaEmeODWkz9gxTAUnjBFQC/BfgGgX4DCEqj0thwQQ5ApbVtBXwkgoCuOSpFyAwlpw+JFGMgAq4aAZo5UfuTtOnDtA8A50oGRvzsQpADFusFuk5QPAJ8QsDEVuYWjbD1QLkJacQGHPkDOVjF/yWAJ4vaA/SB5NCoeXQu1kmyU688zhdwqBmE9Z+kitXoDxSrjT2YtgdaXqD0VAyagvwNAGgCS52haAhCX4ICAYBJcOWUXGoHlxmAfASAli95u82+C7FfgJAKoL8CjhVAQuSgL5gsFqofABADAXYlHF2JOdOuHwBgODIQGtKbA0gjAV8A64LAxuVQGEFFzq67ESoOXMxSVExY7LRuzVJzmVFUApc0AdNWbiQBqDPIvguXT5styjjBdYQvwHwAwEhVIqtMqvWzi902BIR3uGqThZWie7Tc7OaKfAFwXSAtArONAb7skEu5/dLldIGYbklMS4BBYrNCzq0nUD+hH4cPBYGiqu5EqSVl0clYhHxVwogAA== -->\n\n<!-- internal state end -->"},"request":{"retryCount":3,"retries":3,"retryAfter":16}}}

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@zstd/src/encoding/match_generator.rs`:
- Around line 149-156: The call to dfast_match_generator.as_ref().unwrap() in
window_size (and similar unwraps elsewhere) relies on the Matcher trait
invariant that reset() has been called before using Dfast backend; update the
code to make this invariant explicit: either replace unwrap() with
expect("dfast_match_generator must be Some: reset() must have been called per
Matcher trait contract") to fail with a clear message if violated, and/or add a
brief doc comment on the Matcher trait and on the reset() method (and reference
frame_compressor.rs usage) stating the required call order so the unwraps are
documented and safer to reason about.
- Around line 639-643: The call to encode_offset_with_history(candidate.offset
as u32, literals.len() as u32, &mut self.offset_hist) intentionally discards its
return value and is used solely to update self.offset_hist as a side effect; add
a brief inline comment directly above or beside this call stating that the
return value is intentionally ignored and the call exists only for offset
history tracking (mention candidate.offset and literals.len() for context) so
future readers won't mistake the let _ = ... for an oversight.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 365a448d-975e-4a69-b769-683e46735843

📥 Commits

Reviewing files that changed from the base of the PR and between 6c50fea and 155919b.

📒 Files selected for processing (3)
  • zstd/src/encoding/match_generator.rs
  • zstd/src/encoding/mod.rs
  • zstd/tests/cross_validation.rs

Comment thread zstd/src/encoding/match_generator.rs
Comment thread zstd/src/encoding/match_generator.rs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread zstd/src/encoding/match_generator.rs
Comment thread zstd/src/encoding/match_generator.rs
Comment thread zstd/src/encoding/match_generator.rs
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@zstd/src/encoding/match_generator.rs`:
- Around line 609-614: The boundary tail of the previous block isn't being
hashed enough, so before inserting positions for the new block you must backfill
the previous block's tail: in skip_matching (and similarly in start_matching)
call insert_positions covering the last (MAX_LOOKAHEAD-1) bytes of the previous
block (i.e. start from current_abs_start - (LOOKAHEAD-1) up to current_abs_start
+ current_len) so starts in the final 3 bytes (and up to the last 7 bytes for
long hashes) get hashed; use the existing ensure_hash_tables(), window,
history_abs_start, window_size and insert_positions/insert_position helpers to
perform this backfill.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 83f7340c-1dff-41e6-a40d-69a2101f1417

📥 Commits

Reviewing files that changed from the base of the PR and between 6c50fea and 9b0b3e0.

📒 Files selected for processing (3)
  • zstd/src/encoding/match_generator.rs
  • zstd/src/encoding/mod.rs
  • zstd/tests/cross_validation.rs

Comment thread zstd/src/encoding/match_generator.rs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread zstd/src/encoding/match_generator.rs
Comment thread zstd/src/encoding/match_generator.rs
Comment thread zstd/src/encoding/frame_compressor.rs
@polaz polaz force-pushed the feat/#5-default-compression-level branch from 8c0737b to 3595e8f Compare March 26, 2026 20:49
@polaz polaz requested a review from Copilot March 26, 2026 20:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread zstd/src/encoding/match_generator.rs Outdated
Comment thread zstd/src/encoding/blocks/compressed.rs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@polaz polaz merged commit 9c718d5 into main Mar 26, 2026
15 checks passed
@polaz polaz deleted the feat/#5-default-compression-level branch March 26, 2026 21:22
@sw-release-bot sw-release-bot Bot mentioned this pull request Mar 26, 2026
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.

feat: implement Default compression level (zstd level 3, dfast strategy)

2 participants