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

Function BenchmarkHandler_Completion

pkg/lsp/handler_bench_test.go:83–101  ·  view source on GitHub ↗

BenchmarkHandler_Completion benchmarks completion operation

(b *testing.B)

Source from the content-addressed store, hash-verified

81
82// BenchmarkHandler_Completion benchmarks completion operation
83func BenchmarkHandler_Completion(b *testing.B) {
84 server := setupTestServer()
85 sql := "SEL"
86 server.Documents().Open("file:///test.sql", "sql", 1, sql)
87
88 params := CompletionParams{
89 TextDocumentPositionParams: TextDocumentPositionParams{
90 TextDocument: TextDocumentIdentifier{URI: "file:///test.sql"},
91 Position: Position{Line: 0, Character: 3},
92 },
93 }
94 paramsJSON, _ := json.Marshal(params)
95
96 b.ReportAllocs()
97 b.ResetTimer()
98 for i := 0; i < b.N; i++ {
99 _, _ = server.handler.HandleRequest("textDocument/completion", paramsJSON)
100 }
101}
102
103// BenchmarkHandler_CompletionDifferentPrefixes benchmarks completion with various prefixes
104func BenchmarkHandler_CompletionDifferentPrefixes(b *testing.B) {

Callers

nothing calls this directly

Calls 4

setupTestServerFunction · 0.85
OpenMethod · 0.80
DocumentsMethod · 0.80
HandleRequestMethod · 0.80

Tested by

no test coverage detected