Skip to content

Add DiffPlex benchmarks and reduce builder allocations - #158

Draft
mmanela with Copilot wants to merge 6 commits into
masterfrom
copilot/improve-runtime-performance
Draft

Add DiffPlex benchmarks and reduce builder allocations#158
mmanela with Copilot wants to merge 6 commits into
masterfrom
copilot/improve-runtime-performance

Conversation

Copilot AI commented Sep 10, 2026

Copy link
Copy Markdown

Adds a BenchmarkDotNet harness for measuring DiffPlex core diff APIs and records baseline/final results for comparison. Applies low-risk runtime improvements while keeping the public API unchanged.

  • Benchmark coverage
    • Added DiffPlex.Benchmarks with MemoryDiagnoser.
    • Covers core differ APIs, inline builder, and side-by-side builder.
    • Includes small/large inputs across identical, many-small-change, few-large-change, completely different, and long-common-subsequence scenarios.
dotnet run -c Release --project DiffPlex.Benchmarks -- --filter "*" --exporters github csv
  • Recorded results

    • Added benchmarks/RESULTS.md with baseline, final, before/after summary, and ROI notes.
  • Optimizations

    • Reused stateless line/character chunker singletons.
    • Pre-sized side-by-side diff output lists.
    • Replaced LINQ scans in hot/read paths with indexed loops.
    • Tracked side-by-side change summaries during piece construction instead of rescanning.
  • Measured impact

    • Large side-by-side many-small-change case: 1,939.46 μs1,712.49 μs.
    • Side-by-side allocations reduced ~5–9% across key large changed-input scenarios.
    • Additional measured candidates were not retained where results were mixed or low ROI.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 5223aabf-02bd-415f-8d7f-b18c87d2d751

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copilot AI and others added 5 commits September 10, 2026 15:48
Co-authored-by: mmanela <304410+mmanela@users.noreply.github.com>
Co-authored-by: mmanela <304410+mmanela@users.noreply.github.com>
Co-authored-by: mmanela <304410+mmanela@users.noreply.github.com>
Co-authored-by: mmanela <304410+mmanela@users.noreply.github.com>
Co-authored-by: mmanela <304410+mmanela@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve performance of DiffPlex library with benchmarking Add DiffPlex benchmarks and reduce builder allocations Sep 10, 2026
Copilot AI requested a review from mmanela September 10, 2026 16:40
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.

2 participants