Skip to content

benchmarks: add baseline scrolling performance suite#50

Merged
tig merged 1 commit into
developfrom
benchmarks/scrolling-baseline
May 11, 2026
Merged

benchmarks: add baseline scrolling performance suite#50
tig merged 1 commit into
developfrom
benchmarks/scrolling-baseline

Conversation

@tig

@tig tig commented May 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds benchmarks/Terminal.Gui.Editor.Benchmarks project with BenchmarkDotNet, covering the three hot-path layers that determine scroll fluency.
  • Registers the project in Terminal.Gui.Text.slnx and adds BenchmarkDotNet.Artifacts/ to .gitignore.

Benchmark suites

Suite What it measures Parameters
ScrollingBenchmarks Viewport-sized visual line builds at top/middle/bottom, plus full top→bottom scroll simulation Document: 100/1K/10K lines, Viewport: 24/50 rows
VisualLineBuildBenchmarks Per-line build cost across content profiles (short ASCII, long line, tabbed, emoji/ZWJ, mixed CJK+tabs+emoji) 5 content types
DocumentAccessBenchmarks Rope text extraction and line-tree lookups (sequential vs random access patterns) Document: 1K/10K/100K lines

Running

# All suites
dotnet run --project benchmarks/Terminal.Gui.Editor.Benchmarks -c Release

# Single suite
dotnet run --project benchmarks/Terminal.Gui.Editor.Benchmarks -c Release -- --filter "*Scrolling*"

Sample results (ShortRun, Apple M4 Max)

VisualLineBuild — per-line cost:

Content Mean Allocated
Short ASCII (~40 chars) 2.3 µs 11.6 KB
Long ASCII (~200 chars) 13.4 µs 72.0 KB
Tabbed line (4 tabs) 2.6 µs 13.1 KB
Emoji / ZWJ clusters 2.3 µs 10.4 KB

Scrolling — viewport builds (10K-line document, 50-row viewport):

Scenario Mean Allocated
Viewport at top 179 µs 837 KB
Viewport at middle 195 µs 926 KB
Viewport at bottom 201 µs 948 KB
Full scroll top→bottom 42.9 ms 184 MB

The full-scroll number (42 ms for 10K lines) and the per-viewport allocation (~900 KB) confirm that visual-line caching (#49) is the right next optimization.

Test plan

  • dotnet build Terminal.Gui.Text.slnx succeeds with benchmark project included
  • dotnet format --verify-no-changes passes
  • All three benchmark suites run to completion (--job Dry)
  • Existing tests unaffected (benchmarks are a separate project, not in test path)

🤖 Generated with Claude Code

Adds benchmarks/Terminal.Gui.Editor.Benchmarks with BenchmarkDotNet,
covering the three hot-path layers that determine scroll fluency:

- ScrollingBenchmarks: viewport-sized visual line builds at top/middle/
  bottom, plus a full top-to-bottom scroll simulation. Parameterized by
  document size (100/1K/10K lines) and viewport height (24/50 rows).
- VisualLineBuildBenchmarks: per-line build cost across content profiles
  (short ASCII, long line, tabbed, emoji/ZWJ, mixed CJK+tabs+emoji).
- DocumentAccessBenchmarks: rope text extraction and line-tree lookups
  (sequential vs random) at 1K/10K/100K line scales.

Run via:
  dotnet run --project benchmarks/Terminal.Gui.Editor.Benchmarks -c Release

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tig
tig merged commit 4741b75 into develop May 11, 2026
6 checks passed
@tig
tig deleted the benchmarks/scrolling-baseline branch May 11, 2026 03:45
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.

1 participant