MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / BenchmarkHandler_LargeDocument

Function BenchmarkHandler_LargeDocument

pkg/lsp/handler_bench_test.go:361–384  ·  view source on GitHub ↗

BenchmarkHandler_LargeDocument benchmarks operations on large documents

(b *testing.B)

Source from the content-addressed store, hash-verified

359
360// BenchmarkHandler_LargeDocument benchmarks operations on large documents
361func 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
387func BenchmarkDocumentManager_Open(b *testing.B) {

Callers

nothing calls this directly

Calls 6

setupTestServerFunction · 0.85
generateLargeSQLDocumentFunction · 0.85
RunMethod · 0.80
OpenMethod · 0.80
DocumentsMethod · 0.80
HandleRequestMethod · 0.80

Tested by

no test coverage detected