detached a6e1848

perf(theme): keep NewDimmer inlinable by reading DimByAttribute in Dim

commit
a6e1848bcadd7214b5e13c29cab125be14d64d7b
author
brice · · 2026-10-03 14:02 UTC
committer
brice · · 2026-10-03 14:14 UTC
parent
3703ae2
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +6 -3
M internal/usecase/theme/theme.go +6 -3
@@ -418,7 +418,6 @@ const defaultDimmingPercent = 35
418418 // Dimmer transforms resolved terminal colors for subdued UI states. Construct
419419 // it once and reuse it while rendering cells with the same theme and policy.
420420 type Dimmer struct {
421- attribute bool
422421 theme Theme
423422 backgroundPercent int
424423 foregroundPercent int
@@ -448,9 +447,13 @@ func WithForegroundDimming(percent int) DimmerOption {
448447 }
449448
450449 // NewDimmer returns a reusable dimmer with optional per-channel overrides.
450+//
451+// Keep this function inlinable: it sits on the per-cell render path, and adding
452+// fields or work pushes it over the inline budget (80). After changing it,
453+// check `go build -gcflags=-m=2 ./internal/usecase/theme 2>&1 | grep NewDimmer`
454+// and rerun BenchmarkComposeCapturedFrame in internal/usecase/daemon.
451455 func NewDimmer(t Theme, opts ...DimmerOption) Dimmer {
452456 d := Dimmer{
453- attribute: t.DimByAttribute,
454457 theme: t,
455458 backgroundPercent: defaultDimmingPercent,
456459 foregroundPercent: defaultDimmingPercent,
@@ -471,7 +474,7 @@ func NewDimmer(t Theme, opts ...DimmerOption) Dimmer {
471474 // Dim fades a style's resolved background toward the terminal background,
472475 // then fades its foreground and custom underline toward that dimmed background.
473476 func (d Dimmer) Dim(style renderer.Style) renderer.Style {
474- if d.attribute {
477+ if d.theme.DimByAttribute {
475478 style.Attrs |= renderer.AttrDim
476479 return style
477480 }
@@ -418,7 +418,6 @@ const defaultDimmingPercent = 35
418 // Dimmer transforms resolved terminal colors for subdued UI states. Construct418 // Dimmer transforms resolved terminal colors for subdued UI states. Construct
419 // it once and reuse it while rendering cells with the same theme and policy.419 // it once and reuse it while rendering cells with the same theme and policy.
420 type Dimmer struct {420 type Dimmer struct {
421- attribute bool
422 theme Theme421 theme Theme
423 backgroundPercent int422 backgroundPercent int
424 foregroundPercent int423 foregroundPercent int
@@ -448,9 +447,13 @@ func WithForegroundDimming(percent int) DimmerOption {
448 }447 }
449 448
450 // NewDimmer returns a reusable dimmer with optional per-channel overrides.449 // NewDimmer returns a reusable dimmer with optional per-channel overrides.
450+//
451+// Keep this function inlinable: it sits on the per-cell render path, and adding
452+// fields or work pushes it over the inline budget (80). After changing it,
453+// check `go build -gcflags=-m=2 ./internal/usecase/theme 2>&1 | grep NewDimmer`
454+// and rerun BenchmarkComposeCapturedFrame in internal/usecase/daemon.
451 func NewDimmer(t Theme, opts ...DimmerOption) Dimmer {455 func NewDimmer(t Theme, opts ...DimmerOption) Dimmer {
452 d := Dimmer{456 d := Dimmer{
453- attribute: t.DimByAttribute,
454 theme: t,457 theme: t,
455 backgroundPercent: defaultDimmingPercent,458 backgroundPercent: defaultDimmingPercent,
456 foregroundPercent: defaultDimmingPercent,459 foregroundPercent: defaultDimmingPercent,
@@ -471,7 +474,7 @@ func NewDimmer(t Theme, opts ...DimmerOption) Dimmer {
471 // Dim fades a style's resolved background toward the terminal background,474 // Dim fades a style's resolved background toward the terminal background,
472 // then fades its foreground and custom underline toward that dimmed background.475 // then fades its foreground and custom underline toward that dimmed background.
473 func (d Dimmer) Dim(style renderer.Style) renderer.Style {476 func (d Dimmer) Dim(style renderer.Style) renderer.Style {
474- if d.attribute {477+ if d.theme.DimByAttribute {
475 style.Attrs |= renderer.AttrDim478 style.Attrs |= renderer.AttrDim
476 return style479 return style
477 }480 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close