mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-12 15:53:33 -04:00
Add a benchmark for drawing a view with many search matches
If a search has many matches, scrolling the view becomes laggy because every draw takes long. Add a benchmark for this, so that later commits can show how much faster they make drawing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e2418047df
commit
cccd088895
@@ -56,3 +56,18 @@ func BenchmarkWriteToSearchedView(b *testing.B) {
|
||||
v.GetSearchStatus()
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkDrawViewWithManySearchMatches(b *testing.B) {
|
||||
WithSimulationScreen(b, 102, 42)
|
||||
v := NewView("name", 0, 0, 101, 41, OutputNormal)
|
||||
// 44000 matches, as when searching a long log for a single letter.
|
||||
for i := range 4000 {
|
||||
fmt.Fprintf(v, "line %d of a branch log, where we searched for every letter e\n", i)
|
||||
}
|
||||
v.Search("e", nil)
|
||||
v.SetOriginY(2000)
|
||||
|
||||
for b.Loop() {
|
||||
v.draw(true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user