MCPcopy
hub / github.com/micro-editor/micro / benchRead

Function benchRead

internal/buffer/buffer_test.go:132–150  ·  view source on GitHub ↗
(testingB *testing.B, nLines int)

Source from the content-addressed store, hash-verified

130}
131
132func benchRead(testingB *testing.B, nLines int) {
133 rand.Seed(int64(nLines))
134
135 b := NewBufferFromString(randomText(nLines), "", BTDefault)
136
137 testingB.ResetTimer()
138
139 for i := 0; i < testingB.N; i++ {
140 b.Bytes()
141 for j := 0; j < b.LinesNum(); j++ {
142 b.Line(j)
143 b.LineBytes(j)
144 }
145 }
146
147 testingB.StopTimer()
148
149 b.Close()
150}
151
152func benchEdit(testingB *testing.B, nLines, nCursors int) {
153 rand.Seed(int64(nLines + nCursors))

Callers 6

BenchmarkRead10LinesFunction · 0.85
BenchmarkRead100LinesFunction · 0.85
BenchmarkRead1000LinesFunction · 0.85
BenchmarkRead10000LinesFunction · 0.85
BenchmarkRead100000LinesFunction · 0.85

Calls 7

NewBufferFromStringFunction · 0.85
randomTextFunction · 0.85
BytesMethod · 0.80
LineMethod · 0.80
LinesNumMethod · 0.65
LineBytesMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected