BenchmarkHandler_LargeDocument benchmarks operations on large documents
(b *testing.B)
| 359 | |
| 360 | // BenchmarkHandler_LargeDocument benchmarks operations on large documents |
| 361 | func BenchmarkHandler_LargeDocument(b *testing.B) { |
| 362 | sizes := []int{100, 500, 1000, 5000} |
| 363 | |
| 364 | for _, size := range sizes { |
| 365 | b.Run(fmt.Sprintf("%dStatements", size), func(b *testing.B) { |
| 366 | server := setupTestServer() |
| 367 | |
| 368 | // Generate large SQL document |
| 369 | sql := generateLargeSQLDocument(size) |
| 370 | server.Documents().Open("file:///test.sql", "sql", 1, sql) |
| 371 | |
| 372 | params := DocumentSymbolParams{ |
| 373 | TextDocument: TextDocumentIdentifier{URI: "file:///test.sql"}, |
| 374 | } |
| 375 | paramsJSON, _ := json.Marshal(params) |
| 376 | |
| 377 | b.ReportAllocs() |
| 378 | b.ResetTimer() |
| 379 | for i := 0; i < b.N; i++ { |
| 380 | _, _ = server.handler.HandleRequest("textDocument/documentSymbol", paramsJSON) |
| 381 | } |
| 382 | }) |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | // BenchmarkDocumentManager_Open benchmarks document opening |
| 387 | func BenchmarkDocumentManager_Open(b *testing.B) { |
nothing calls this directly
no test coverage detected