Benchmark string interning
(b *testing.B)
| 243 | |
| 244 | // Benchmark string interning |
| 245 | func 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 | |
| 265 | func BenchmarkWithoutInterning(b *testing.B) { |
| 266 | categories := []string{"Active", "Inactive", "Pending", "Completed", "Failed"} |
nothing calls this directly
no test coverage detected