mirror of
https://github.com/uutils/diffutils.git
synced 2026-06-10 15:48:59 -07:00
50057412bd
The utility should support all the arguments supported by GNU cmp and
perform slightly better.
On a "bad" scenario, ~36M files which are completely different, our
version runs in ~72% of the time of the original on my M1 Max:
> hyperfine --warmup 1 -i --output=pipe \
'cmp -l huge huge.3'
Benchmark 1: cmp -l huge huge.3
Time (mean ± σ): 3.237 s ± 0.014 s [User: 2.891 s, System: 0.341 s]
Range (min … max): 3.221 s … 3.271 s 10 runs
Warning: Ignoring non-zero exit code.
> hyperfine --warmup 1 -i --output=pipe \
'../target/release/diffutils cmp -l huge huge.3'
Benchmark 1: ../target/release/diffutils cmp -l huge huge.3
Time (mean ± σ): 2.392 s ± 0.009 s [User: 1.978 s, System: 0.406 s]
Range (min … max): 2.378 s … 2.406 s 10 runs
Warning: Ignoring non-zero exit code.
Our cmp runs in ~116% of the time when comparing libxul.so to the
chromium-browser binary with -l and -b. In a best case scenario of
comparing 2 files which are the same except for the last byte, our
tool is slightly faster.
75 lines
2.1 KiB
YAML
75 lines
2.1 KiB
YAML
name: Fuzzing
|
|
|
|
# spell-checker:ignore fuzzer
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
jobs:
|
|
fuzz-build:
|
|
name: Build the fuzzers
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
- name: Install `cargo-fuzz`
|
|
run: cargo install cargo-fuzz
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: "cargo-fuzz-cache-key"
|
|
cache-directories: "fuzz/target"
|
|
- name: Run `cargo-fuzz build`
|
|
run: cargo +nightly fuzz build
|
|
|
|
fuzz-run:
|
|
needs: fuzz-build
|
|
name: Run the fuzzers
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
env:
|
|
RUN_FOR: 60
|
|
strategy:
|
|
matrix:
|
|
test-target:
|
|
- { name: fuzz_cmp, should_pass: true }
|
|
- { name: fuzz_cmp_args, should_pass: true }
|
|
- { name: fuzz_ed, should_pass: true }
|
|
- { name: fuzz_normal, should_pass: true }
|
|
- { name: fuzz_patch, should_pass: true }
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
- name: Install `cargo-fuzz`
|
|
run: cargo install cargo-fuzz
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: "cargo-fuzz-cache-key"
|
|
cache-directories: "fuzz/target"
|
|
- name: Restore Cached Corpus
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
key: corpus-cache-${{ matrix.test-target.name }}
|
|
path: |
|
|
fuzz/corpus/${{ matrix.test-target.name }}
|
|
- name: Run ${{ matrix.test-target.name }} for XX seconds
|
|
shell: bash
|
|
continue-on-error: ${{ !matrix.test-target.name.should_pass }}
|
|
run: |
|
|
cargo +nightly fuzz run ${{ matrix.test-target.name }} -- -max_total_time=${{ env.RUN_FOR }} -detect_leaks=0
|
|
- name: Save Corpus Cache
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
key: corpus-cache-${{ matrix.test-target.name }}
|
|
path: |
|
|
fuzz/corpus/${{ matrix.test-target.name }}
|