v0.5.0 c37833b

baseline_bench_test.go RawHistoryFolder

1package sessionwire
2
3import (
4	"net"
5	"testing"
6
7	"github.com/bnema/vev/internal/adapters/ipc"
8	"github.com/bnema/vev/internal/domain"
9	"github.com/bnema/vev/internal/protocol"
10)
11
12// Baseline typed-conversation benchmark frozen in P1.1: one Hello/Welcome
13// plus one Input/Output exchange over net.Pipe IPC transports. AC8 compares
14// the equivalent Protobuf conversation against this median.
15
16func BenchmarkTypedClientServerRoundTrip(b *testing.B) {
17	clientRaw, serverRaw := net.Pipe()
18	defer func() {
19		_ = clientRaw.Close()
20		_ = serverRaw.Close()
21	}()
22	client := NewClientConnection(ipc.NewTransport(clientRaw))
23	server := NewServerConnection(ipc.NewTransport(serverRaw))
24
25	hello := protocol.Hello{Version: protocol.Version, Intent: protocol.IntentAttach, Size: domain.Size{Cols: 80, Rows: 24}}
26	welcome := protocol.Welcome{SessionID: "sess-1", SessionName: "work"}
27	input := protocol.Input{InputSeq: 1, Data: []byte("x")}
28	context := testUIOutputContext()
29	output := protocol.Output{Epoch: 1, New: 1, Full: true, Size: domain.Size{Cols: 80, Rows: 24}, Context: context, Data: []byte("row")}
30
31	b.ReportAllocs()
32	b.ResetTimer()
33	for b.Loop() {
34		done := make(chan error, 1)
35		go func() {
36			if err := client.SendClient(hello); err != nil {
37				done <- err
38				return
39			}
40			if _, err := client.ReceiveServer(); err != nil {
41				done <- err
42				return
43			}
44			if err := client.SendClient(input); err != nil {
45				done <- err
46				return
47			}
48			_, err := client.ReceiveServer()
49			done <- err
50		}()
51		if _, err := server.ReceiveClient(); err != nil {
52			b.Fatal(err)
53		}
54		if err := server.SendServer(welcome); err != nil {
55			b.Fatal(err)
56		}
57		if _, err := server.ReceiveClient(); err != nil {
58			b.Fatal(err)
59		}
60		if err := server.SendServer(output); err != nil {
61			b.Fatal(err)
62		}
63		if err := <-done; err != nil {
64			b.Fatal(err)
65		}
66	}
67}

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