next.js
a3cfbd5d - fix(turbo-persistence): Fix `verify_sst_content` feature, improve unit test performance (#78388)

Commit
1 year ago
fix(turbo-persistence): Fix `verify_sst_content` feature, improve unit test performance (#78388) ## Why? I'm trying to run https://github.com/boshen/cargo-shear over our workspace to remove unused dependencies. It runs `cargo expand` with `--all-features`, which was breaking on this crate. ## Changes Summary - Add `opt-level = 1` in dev for this crate. - Reduce the iterations used in tests. If we really want tons of iterations, we should use benchmarks or write a fuzzer utility. Unit tests should be small and fast. - Increase the test for blobs to use a 65KiB blob size and assert that's larger than the blob threshold. - Cleanup: Use the more-correct `u32` type for the `family` field in a few more places instead of `usize` and make the numeric representations of the `KeySpace` enum a bit more explicit. ## Prior to these changes - Building with `--features turbo-persistence/verify_sst_content` would fail with compilation errors - Unit tests would take multiple minutes to run - The blob test didn't appear to actually test blobs (10KiB < 64KiB) ## After these changes - The `verify_sst_content` feature works and passes unit tests - Unit tests finish in about a minute with `cargo test` and `cargo nextest`, this is still slow, but much better than it was. - Unit tests actually test blobs as intended. ![Screenshot 2025-04-21 at 2.12.32 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/HAZVitxRNnZz8QMiPn4a/ff7aa104-c193-4514-9fde-1a6fcc11acf8.png) ## Potential future work It would be useful to be able to adjust the medium and large (blob) size thresholds to allow us to lower those thresholds in tests.
Author
bgw bgw
Parents
Loading