Skip to content

Repeat writes the text once; cut 2.18.1 - #62

Merged
HarryCordewener merged 2 commits into
mainfrom
claude/markup-repeat-fast-path-gbm3pm
Oct 13, 2026
Merged

HarryCordewener merged 2 commits into
mainfrom
claude/markup-repeat-fast-path-gbm3pm

Conversation

@HarryCordewener

@HarryCordewener HarryCordewener commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Requested by Grave · project thread

Before: MarkupText.Repeat(n) filled an array with n references to the text and concatenated them, about 18 bytes and 16-28 ns a character. SharpMUSH's space() and every layout fill and blank line go through it.

After: the string is built with a few doubling block copies and the runs are written directly. One style over the whole text becomes a single run without the coalescing pass. The result matches the concatenated copies.

before after
Space.Repeat(1000) 27.8 us, 18 KB 0.4 us, 2 KB
Plain("ab").Repeat(1000) 13.0 us, 20 KB 1.0 us, 4 KB
Space.Repeat(1000000) 18.5 ms, 18 MB 1.0 ms, 2 MB
Plain("ab").Repeat(1000000) 21.9 ms, 20 MB 1.3 ms, 4 MB

(Release build, net11.0 RC1, 4-core cloud container.)

How: Repeat_MatchesConcatenatedCopies checks text and runs against the old concatenation for plain, single-style, mixed-style and bell (point) units at several counts; Repeat_PlainText_AllocatesOnlyTheString bounds the allocation.

Release cut (second commit): v2.17.0 and v2.18.0 were tagged without a cut, so this puts AsciiFold under 2.17.0, the theme colours under 2.18.0 and this change under 2.18.1, moves their API to PublicAPI.Shipped.txt, and validates packages against 2.18.0. dotnet pack -c Release with 2.18.1 passes package validation. Tag v2.18.1 after merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DGK2ENFwejRuxQ4am7VoVo


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Added ASCII folding for text, including optional Latin-1 support, and text-mapping support across layout blocks.
    • Added theme palette completion and additional semantic and color theme roles.
  • Performance
    • Repeating text now uses more efficient text construction, with reduced allocations for plain text. Padding, fills, and layout blank lines also benefit.

Repeat(n) filled an array with n references and concatenated them, about
18 bytes and 16-28 ns a character. It now builds the string with a few
doubling block copies and the runs directly; one style over the whole
text becomes one run without the coalescing pass. Space.Repeat(1000000)
goes from 18.5 ms / 18 MB to 1.0 ms / 2 MB, Space.Repeat(1000) from
27.8 us to 0.4 us. The result matches the concatenated copies.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DGK2ENFwejRuxQ4am7VoVo
Put AsciiFold under 2.17.0, the theme colours under 2.18.0 and the Repeat
change under 2.18.1, move their API to PublicAPI.Shipped.txt, and validate
packages against 2.18.0.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DGK2ENFwejRuxQ4am7VoVo
@HarryCordewener HarryCordewener self-assigned this Oct 13, 2026
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: eaabea59-099e-4946-8e2b-e3a46fd214ee
📥 Commits

Reviewing files that changed from the base of the PR and between 09b995c and 564df0f.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • MarkupString.Ansi/MarkupString.Ansi.csproj
  • MarkupString.Html/MarkupString.Html.csproj
  • MarkupString.Mxp/MarkupString.Mxp.csproj
  • MarkupString.Pueblo/MarkupString.Pueblo.csproj
  • MarkupString.Tests/MarkupTextOperationsTests.cs
  • MarkupString/MarkupString.csproj
  • MarkupString/MarkupText.Operations.cs
  • MarkupString/PublicAPI.Shipped.txt
  • MarkupString/PublicAPI.Unshipped.txt
💤 Files with no reviewable changes (1)
  • MarkupString/PublicAPI.Unshipped.txt

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Walkthrough

Repeat now constructs repeated text directly and preserves markup runs. Tests cover repeated output and allocation. The shipped API listing, release notes, and package validation baselines are also updated.

Changes

Repeat and Release Updates

Layer / File(s) Summary
Repeat construction and validation
MarkupString/MarkupText.Operations.cs, MarkupString.Tests/MarkupTextOperationsTests.cs, CHANGELOG.md
Repeat builds repeated text directly and preserves markup runs. Tests compare its output with concatenated copies and check allocations for repeated spaces. The 2.18.1 notes describe the change.
Shipped API entries
MarkupString/PublicAPI.Shipped.txt, MarkupString/PublicAPI.Unshipped.txt
The shipped API listing adds AsciiFold, LayoutContext.Fold, theme entries, and MapText methods. The corresponding entries are removed from the unshipped listing.
Release notes and package baselines
CHANGELOG.md, MarkupString*.csproj, MarkupString.Ansi/MarkupString.Ansi.csproj, MarkupString.Html/MarkupString.Html.csproj, MarkupString.Mxp/MarkupString.Mxp.csproj, MarkupString.Pueblo/MarkupString.Pueblo.csproj
The changelog revises the 2.17.0 and 2.18.0 entries. Package validation baselines change from 2.15.5 to 2.18.0.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 564df

The faster Repeat produces the same text and markup as concatenating copies. The version, changelog, and API-listing updates are consistent with the 2.18.1 release cut. No merge-blocking risk remains.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (7 skipped: 7… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title identifies the main Repeat change and the 2.18.1 release cut. It is concise and related to the pull request objectives.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (7 skipped: 7 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@HarryCordewener
HarryCordewener merged commit 0dc73cc into main Oct 13, 2026
7 checks passed
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