Skip to content

fix(common): Eliminate intermediate array allocations#319

Merged
piotrzajac merged 1 commit intomasterfrom
fix/eliminate-intermediate-array-allocations
Apr 12, 2026
Merged

fix(common): Eliminate intermediate array allocations#319
piotrzajac merged 1 commit intomasterfrom
fix/eliminate-intermediate-array-allocations

Conversation

@piotrzajac
Copy link
Copy Markdown
Collaborator

@piotrzajac piotrzajac commented Apr 12, 2026

Summary

Summary by CodeRabbit

  • Documentation

    • Updated developer workflow guidance with post-change build and test procedures.
  • Chores

    • Improved internal array allocation performance.
    • Added backlog task tracking implementation improvements.

Checklist

  • Commit messages follow Conventional Commits (type(scope): description)
  • dotnet build src/Objectivity.AutoFixture.XUnit2.AutoMock.sln passes with no warnings
  • dotnet test src/Objectivity.AutoFixture.XUnit2.AutoMock.sln passes on all framework slices
  • Code coverage remains at least at the level prior the change (verified by Codecov)
  • Mutation score remains at least at the level prior the change (verified by Stryker)
  • New tests follow the GIVEN/WHEN/THEN naming convention and AAA structure (see AGENTS.md)
  • No new [SuppressMessage] without a justification comment
  • No // TODO: comments added — open a GitHub issue instead
  • No new dependencies introduced that are incompatible with the MIT license (verified by FOSSA)

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 12, 2026

📝 Walkthrough

Walkthrough

The PR adds a backlog task document and updates developer workflow documentation. It refactors TryGetEnumerableSingleTypeArgument in EnumerableExtensions.cs to search for generic IEnumerable<> interfaces directly, avoiding Concat().ToArray() intermediate allocations.

Changes

Cohort / File(s) Summary
Documentation & Backlog
.backlog/tasks/task-12-Eliminate-intermediate-array-allocations.md, AGENTS.md
Added backlog task detailing the optimization objective and updated developer workflow guidance with explicit post-change build/test/mutation-test steps.
Implementation
src/Objectivity.AutoFixture.XUnit2.Core/Common/EnumerableExtensions.cs
Refactored TryGetEnumerableSingleTypeArgument to search type.GetInterfaces() directly using Array.Find() with new IsGenericEnumerable() predicate, eliminating intermediate interface array construction via Concat().ToArray().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description lacks the required Summary section with issue details and PR label. Only a checklist is provided with the Summary placeholder unfilled. Add a descriptive summary explaining the change to eliminate intermediate array allocations and reference the issue number (e.g., 'Closes #XXX'). Add a label to the PR.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: eliminating intermediate array allocations in the common utilities, which is directly reflected in the code changes to EnumerableExtensions.cs.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/eliminate-intermediate-array-allocations

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 and usage tips.

@piotrzajac piotrzajac self-assigned this Apr 12, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 12, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b985f04) to head (216cf3d).
⚠️ Report is 2 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #319   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           39        39           
  Lines          424       421    -3     
  Branches        55        55           
=========================================
- Hits           424       421    -3     
Flag Coverage Δ
unittests 99.76% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown

Qodana Community for .NET

Analyzed project: src/

It seems all right 👌

No new problems were found according to the checks applied

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2025.3.2
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

@piotrzajac piotrzajac merged commit 6d247e7 into master Apr 12, 2026
21 checks passed
@piotrzajac piotrzajac deleted the fix/eliminate-intermediate-array-allocations branch April 12, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants