Skip to content

test: add benchmarks for ui hotspots#84

Merged
JayanAXHF merged 2 commits intomainfrom
test/add-benchmarks
Mar 8, 2026
Merged

test: add benchmarks for ui hotspots#84
JayanAXHF merged 2 commits intomainfrom
test/add-benchmarks

Conversation

@JayanAXHF
Copy link
Owner

@JayanAXHF JayanAXHF commented Mar 8, 2026

TL;DR

Added Criterion benchmarking infrastructure to measure performance of UI rendering hotspots, specifically issue list preview generation and markdown rendering.

What changed?

  • Created benches/ui_hotspots.rs with benchmarks for issue_list_preview and markdown_render functions
  • Added bench_support.rs module containing benchmark helper functions and test fixtures
  • Extracted build_issue_body_preview function from inline code in issue_list.rs to enable benchmarking

Copy link
Owner Author

JayanAXHF commented Mar 8, 2026

@JayanAXHF JayanAXHF marked this pull request as ready for review March 8, 2026 03:33
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 8, 2026

Greptile Summary

This PR adds Criterion benchmarking infrastructure targeting two UI rendering hotspots — issue list preview generation and markdown rendering — and refactors build_issue_body_preview out of inline code in issue_list.rs to make it independently testable.

Extraction of build_issue_body_preview: The wrapping-and-truncation logic is correctly pulled into a pub(crate) function with identical behavior to the original inline code; the refactor is safe.

Benchmark structure: benches/ui_hotspots.rs is well-formed — it uses black_box, Throughput::Bytes, and BenchmarkId correctly for multi-dimensional parametrized benchmarks.

bench_support visibility: pub mod bench_support is added to src/lib.rs without any #[cfg(...)] gate, causing benchmark fixture/helper code to be compiled into every build and to appear in the crate's public API. Gating it behind a Cargo feature would keep the public surface clean and avoid dead code in production binaries.

profiling Cargo profile: The new [profile.profiling] entry is a useful addition for future perf work.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["benches/ui_hotspots.rs\n(Criterion binary)"] -->|"gitv_tui::bench_support::*"| B["src/bench_support.rs\n(pub wrapper module)"]
    B -->|"build_issue_body_preview()"| C["src/ui/components/issue_list.rs\nbuild_issue_body_preview()"]
    B -->|"render_markdown_lines()"| D["src/ui/components/issue_conversation.rs\nrender_markdown_lines()"]
    C --> E["textwrap::wrap() + truncate(2) + join(' ')"]
    D --> F["MarkdownRenderer → Vec<Line<'static>>"]
    A -->|"issue_body_fixture(repeat)"| G["String input\n(plain text, URLs, unicode)"]
    A -->|"markdown_fixture(repeat)"| H["String input\n(headings, lists, code blocks, tables)"]
    G --> C
    H --> D
Loading

Last reviewed commit: 6077fea

Copy link
Owner Author

JayanAXHF commented Mar 8, 2026

Merge activity

  • Mar 8, 6:04 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 8, 6:04 AM UTC: @JayanAXHF merged this pull request with Graphite.

@JayanAXHF JayanAXHF merged commit f4043ac into main Mar 8, 2026
3 checks passed
@JayanAXHF JayanAXHF deleted the test/add-benchmarks branch March 8, 2026 06:08
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