MCPcopy Index your code
hub / github.com/codechenx/FastTableViewer / BenchmarkStringInterning

Function BenchmarkStringInterning

string_interning_test.go:245–263  ·  view source on GitHub ↗

Benchmark string interning

(b *testing.B)

Source from the content-addressed store, hash-verified

243
244// Benchmark string interning
245func BenchmarkStringInterning(b *testing.B) {
246 // Create dataset with repeated values
247 categories := []string{"Active", "Inactive", "Pending", "Completed", "Failed"}
248 data := [][]string{{"Status", "ID"}}
249
250 for i := 0; i < 1000; i++ {
251 data = append(data, []string{
252 categories[i%len(categories)],
253 fmt.Sprintf("%d", i),
254 })
255 }
256
257 b.ResetTimer()
258 for i := 0; i < b.N; i++ {
259 buf, _ := createNewBufferWithData(data, false)
260 buf.rowFreeze = 1
261 buf.enableStringInterning()
262 }
263}
264
265func BenchmarkWithoutInterning(b *testing.B) {
266 categories := []string{"Active", "Inactive", "Pending", "Completed", "Failed"}

Callers

nothing calls this directly

Calls 2

createNewBufferWithDataFunction · 0.85
enableStringInterningMethod · 0.80

Tested by

no test coverage detected