// Fenrir console screen reader. // Copyright (c) 2026 Storm Dragon // SPDX-License-Identifier: GPL-3.0-or-later // // This program is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free // Software Foundation, either version 3 of the License, or (at your option) // any later version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for // more details. // // You should have received a copy of the GNU General Public License along with // this program. If not, see . package reader import ( "testing" "git.stormux.org/storm/fenrir/internal/command" "git.stormux.org/storm/fenrir/internal/screen" ) func BenchmarkTypingAndReview(b *testing.B) { for _, geometry := range []struct { name string rows, cols int }{ {"80x25", 25, 80}, {"240x67", 67, 240}, } { b.Run(geometry.name, func(b *testing.B) { first := screen.Snapshot{Terminal: 1, Active: true, Rows: geometry.rows, Cols: geometry.cols, Cells: make([]rune, geometry.rows*geometry.cols)} for i := range first.Cells { first.Cells[i] = ' ' } second := first second.Cells = append([]rune(nil), first.Cells...) second.Cells[0], second.X = 'a', 1 r := New() r.Update(first) b.ReportAllocs() b.ResetTimer() for b.Loop() { r.Update(second) r.Command(command.CurrentChar) r.Update(first) } }) } }