BenchmarkHandler_Completion benchmarks completion operation
(b *testing.B)
| 81 | |
| 82 | // BenchmarkHandler_Completion benchmarks completion operation |
| 83 | func 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 |
| 104 | func BenchmarkHandler_CompletionDifferentPrefixes(b *testing.B) { |
nothing calls this directly
no test coverage detected