detached 69d5b14

test(performance): measure warmed layout and batch buffers

commit
69d5b14955e830459e97231595f885ccce19a7ea
author
brice · · 2026-09-30 04:23 UTC
parent
c1d1834
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +9 -1
M internal/layout/paint_bench_test.go +4 -0
@@ -53,7 +53,11 @@ func BenchmarkPaint(b *testing.B) {
5353
5454 func BenchmarkLayoutPaintTree(b *testing.B) {
5555 root, opts := paintFixture(b, 100)
56+ if _, err := Layout(root, opts); err != nil {
57+ b.Fatal(err)
58+ }
5659 b.ReportAllocs()
60+ b.ResetTimer()
5761 for i := 0; i < b.N; i++ {
5862 if _, err := Layout(root, opts); err != nil {
5963 b.Fatal(err)
@@ -53,7 +53,11 @@ func BenchmarkPaint(b *testing.B) {
53 53
54 func BenchmarkLayoutPaintTree(b *testing.B) {54 func BenchmarkLayoutPaintTree(b *testing.B) {
55 root, opts := paintFixture(b, 100)55 root, opts := paintFixture(b, 100)
56+ if _, err := Layout(root, opts); err != nil {
57+ b.Fatal(err)
58+ }
56 b.ReportAllocs()59 b.ReportAllocs()
60+ b.ResetTimer()
57 for i := 0; i < b.N; i++ {61 for i := 0; i < b.N; i++ {
58 if _, err := Layout(root, opts); err != nil {62 if _, err := Layout(root, opts); err != nil {
59 b.Fatal(err)63 b.Fatal(err)
M internal/render/instances_bench_test.go +4 -0
@@ -31,6 +31,7 @@ func listFixture(n int) Frame {
3131 func BenchmarkListBatches(b *testing.B) {
3232 frame := listFixture(2000)
3333 b.ReportAllocs()
34+ b.ResetTimer()
3435 for i := 0; i < b.N; i++ {
3536 instances, batches, stats := ListBatches(frame)
3637 if len(instances) != 2000 || len(batches) == 0 || len(stats.Skipped) != 0 {
@@ -42,7 +43,10 @@ func BenchmarkListBatches(b *testing.B) {
4243 func BenchmarkListBufferReuse(b *testing.B) {
4344 frame := listFixture(2000)
4445 var buf ListBuffer
46+ buf.List(frame)
47+ buf.Release()
4548 b.ReportAllocs()
49+ b.ResetTimer()
4650 for i := 0; i < b.N; i++ {
4751 instances, batches, stats := buf.List(frame)
4852 if len(instances) != 2000 || len(batches) == 0 || len(stats.Skipped) != 0 {
@@ -31,6 +31,7 @@ func listFixture(n int) Frame {
31 func BenchmarkListBatches(b *testing.B) {31 func BenchmarkListBatches(b *testing.B) {
32 frame := listFixture(2000)32 frame := listFixture(2000)
33 b.ReportAllocs()33 b.ReportAllocs()
34+ b.ResetTimer()
34 for i := 0; i < b.N; i++ {35 for i := 0; i < b.N; i++ {
35 instances, batches, stats := ListBatches(frame)36 instances, batches, stats := ListBatches(frame)
36 if len(instances) != 2000 || len(batches) == 0 || len(stats.Skipped) != 0 {37 if len(instances) != 2000 || len(batches) == 0 || len(stats.Skipped) != 0 {
@@ -42,7 +43,10 @@ func BenchmarkListBatches(b *testing.B) {
42 func BenchmarkListBufferReuse(b *testing.B) {43 func BenchmarkListBufferReuse(b *testing.B) {
43 frame := listFixture(2000)44 frame := listFixture(2000)
44 var buf ListBuffer45 var buf ListBuffer
46+ buf.List(frame)
47+ buf.Release()
45 b.ReportAllocs()48 b.ReportAllocs()
49+ b.ResetTimer()
46 for i := 0; i < b.N; i++ {50 for i := 0; i < b.N; i++ {
47 instances, batches, stats := buf.List(frame)51 instances, batches, stats := buf.List(frame)
48 if len(instances) != 2000 || len(batches) == 0 || len(stats.Skipped) != 0 {52 if len(instances) != 2000 || len(batches) == 0 || len(stats.Skipped) != 0 {
M internal/render/prepare_alloc_test.go +1 -1
@@ -119,7 +119,7 @@ func TestPrepareQuadAllocationsDoNotScaleWithCommands(t *testing.T) {
119119 t.Fatal(err)
120120 }
121121 })
122- if allocs > 3 {
122+ if allocs > 2 {
123123 t.Fatalf("%v allocs for 512 rects, want a small constant", allocs)
124124 }
125125 }
@@ -119,7 +119,7 @@ func TestPrepareQuadAllocationsDoNotScaleWithCommands(t *testing.T) {
119 t.Fatal(err)119 t.Fatal(err)
120 }120 }
121 })121 })
122- if allocs > 3 {122+ if allocs > 2 {
123 t.Fatalf("%v allocs for 512 rects, want a small constant", allocs)123 t.Fatalf("%v allocs for 512 rects, want a small constant", allocs)
124 }124 }
125 }125 }

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 1

Tags 12

↑↓ moveenter openesc close