Skip to content

Add performance and allocation review learnings from PR #327#354

Merged
jonathanpeppers merged 1 commit intomainfrom
improvements/review-learnings-from-327
May 4, 2026
Merged

Add performance and allocation review learnings from PR #327#354
jonathanpeppers merged 1 commit intomainfrom
improvements/review-learnings-from-327

Conversation

@rmarinho
Copy link
Copy Markdown
Member

@rmarinho rmarinho commented Apr 30, 2026

Adds performance and allocation review learnings from PR #327 to the reviewer skill and Copilot instructions.

Changes

.github/copilot-instructions.md

  • Add Reuse buffers guidance (ArrayPool<byte>.Shared + reusable readonly byte[] fields)
  • Add Document thread-safety guidance (<remarks>This class is not thread-safe.</remarks>)

.github/skills/android-tools-reviewer/SKILL.md

  • Add "Prefer existing repo patterns" workflow step — grep for ArrayPool, ObjectPool, MemoryStreamPool, ProcessUtils before suggesting new infrastructure

.github/skills/android-tools-reviewer/references/csharp-rules.md

  • Add Reuse hot-path buffers and Reuse loop helpers to the Performance section
  • Add Document thread-safety invariants to the Code Organization section

Removed from original PR (per review feedback)

  • UTF-8 string literal guidance — ReadOnlySpan<byte> works on netstandard2.0 via System.Memory
  • Encoding.ASCII.GetBytes() recommendation — wrong for non-ASCII content
  • "No string intermediates in protocols" — overly prescriptive
  • "No stackalloc in async I/O" — already a compiler error, not a review concern

Also rebased onto main to resolve merge conflicts from PR #355 (which split review-rules.md into per-category files).

Copilot AI review requested due to automatic review settings April 30, 2026 16:08
Copy link
Copy Markdown
Contributor

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

Updates the repository’s reviewer guidance and Copilot instructions to incorporate performance/allocation learnings from PR #327, aiming to reduce allocation-heavy suggestions and align reviews with established repo patterns.

Changes:

  • Expanded review-rules.md with new performance/allocation rules (ArrayPool usage, reusable buffers, avoiding string intermediates, async/stackalloc constraints, thread-safety documentation).
  • Updated SKILL.md workflow guidance to grep for existing repo patterns before proposing new infrastructure.
  • Enhanced .github/copilot-instructions.md with buffer-management and thread-safety guidance, plus netstandard2.0 notes.

Reviewed changes

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

File Description
.github/skills/android-tools-reviewer/references/review-rules.md Adds new performance/allocation and thread-safety review rules, plus updated netstandard2.0 guidance.
.github/skills/android-tools-reviewer/SKILL.md Adds workflow guidance to prefer existing repo patterns (ArrayPool/ObjectPool/ProcessUtils) before suggesting alternatives.
.github/copilot-instructions.md Updates Copilot guidance for netstandard2.0, buffer reuse/ArrayPool, and thread-safety documentation expectations.

Comment thread .github/skills/android-tools-reviewer/references/review-rules.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/skills/android-tools-reviewer/references/review-rules.md Outdated
Comment thread .github/copilot-instructions.md Outdated
@rmarinho rmarinho force-pushed the improvements/review-learnings-from-327 branch from d361fce to fc4c108 Compare April 30, 2026 16:15
@rmarinho rmarinho requested a review from Copilot April 30, 2026 17:00
@rmarinho rmarinho added the copilot `copilot-cli` or other AIs were used to author this label Apr 30, 2026
Copy link
Copy Markdown
Contributor

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

Updates the repository’s reviewer skill guidance and Copilot instructions to incorporate performance/allocation review learnings (from PR #327), with emphasis on hot-path buffer reuse and avoiding avoidable allocations in protocol code.

Changes:

  • Expanded reviewer rules to include new performance/allocation guidance (ArrayPool, reusable buffers, avoiding string intermediates, async stackalloc caveat, loop helper reuse, thread-safety remarks).
  • Updated the reviewer workflow to explicitly prefer existing repo patterns before proposing new infrastructure.
  • Enhanced Copilot instructions with buffer reuse guidance and additional netstandard2.0 considerations.

Reviewed changes

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

File Description
.github/skills/android-tools-reviewer/references/review-rules.md Adds performance/allocation-focused review checks and thread-safety documentation guidance.
.github/skills/android-tools-reviewer/SKILL.md Adds workflow guidance to grep for existing repo patterns before suggesting new ones.
.github/copilot-instructions.md Adds Copilot guidance on buffer reuse and netstandard2.0 compatibility pitfalls.

Comment thread .github/skills/android-tools-reviewer/references/review-rules.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/skills/android-tools-reviewer/references/review-rules.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Address review feedback:
- Remove incorrect UTF-8 string literal guidance (ReadOnlySpan<byte>
  exists on netstandard2.0 via System.Memory)
- Remove "No string intermediates in protocols" rule (overly prescriptive)
- Remove "No stackalloc in async I/O" rule (compiler enforces this)
- Remove Encoding.ASCII recommendation (wrong for non-ASCII content)
- Move valid rules to split files (csharp-rules.md) after PR #355 split
- Keep: buffer reuse, thread-safety docs, loop helper reuse, prefer
  existing repo patterns

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers force-pushed the improvements/review-learnings-from-327 branch from fc4c108 to 89ab055 Compare May 4, 2026 14:23
@jonathanpeppers jonathanpeppers merged commit 01c68c1 into main May 4, 2026
2 checks passed
@jonathanpeppers jonathanpeppers deleted the improvements/review-learnings-from-327 branch May 4, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot `copilot-cli` or other AIs were used to author this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants