fn server_completion_package(c: &mut Criterion) {
    let fluxscript = r#"import "sql"

sql."#;
    let server = create_server();
    open_file(&server, fluxscript.to_string());

    let params = lsp_types::CompletionParams {
        text_document_position:
            lsp_types::TextDocumentPositionParams {
                text_document: lsp_types::TextDocumentIdentifier {
                    uri: lsp_types::Url::parse(
                        "file:///home/user/file.flux",
                    )
                    .unwrap(),
                },
                position: lsp_types::Position {
                    line: 2,
                    character: 3,
                },
            },
        work_done_progress_params:
            lsp_types::WorkDoneProgressParams {
                work_done_token: None,
            },
        partial_result_params: lsp_types::PartialResultParams {
            partial_result_token: None,
        },
        context: Some(lsp_types::CompletionContext {
            trigger_kind:
                lsp_types::CompletionTriggerKind::TriggerCharacter,
            trigger_character: Some(".".to_string()),
        }),
    };

    c.bench_function("server completion", |b| {
        b.iter(|| {
            block_on(black_box(server.completion(params.clone())))
                .unwrap()
                .unwrap();
        })
    });
}
/// Benchmark the response for a package completion
Benchmark the response for a package completion
Benchmark the response for a package completion
fn server_completion_package(c: &mut Criterion) {
    let fluxscript = r#"import "sql"
sql."#;
    let server = create_server();
    open_file(&server, fluxscript.to_string());
    let params = lsp_types::CompletionParams {
        text_document_position:
            lsp_types::TextDocumentPositionParams {
                text_document: lsp_types::TextDocumentIdentifier {
                    uri: lsp_types::Url::parse(
                        "file:///home/user/file.flux",
                    )
                    .unwrap(),
                },
                position: lsp_types::Position {
                    line: 2,
                    character: 3,
                },
            },
        work_done_progress_params:
            lsp_types::WorkDoneProgressParams {
                work_done_token: None,
            },
        partial_result_params: lsp_types::PartialResultParams {
            partial_result_token: None,
        },
        context: Some(lsp_types::CompletionContext {
            trigger_kind:
                lsp_types::CompletionTriggerKind::TriggerCharacter,
            trigger_character: Some(".".to_string()),
        }),
    };
    c.bench_function("server completion", |b| {
        b.iter(|| {
            block_on(black_box(server.completion(params.clone())))
                .unwrap()
                .unwrap();
        })
    });
}
fn server_completion_package ( c : & mut Criterion ) { let fluxscript = r#"import "sql"

sql."# ; let server = create_server ( ) ; open_file ( & server , fluxscript . to_string ( ) ) ; let params = lsp_types :: CompletionParams { text_document_position : lsp_types :: TextDocumentPositionParams { text_document : lsp_types :: TextDocumentIdentifier { uri : lsp_types :: Url :: parse ( " " , ) . unwrap ( ) , } , position : lsp_types :: Position { line : 2 , character : 3 , } , } , work_done_progress_params : lsp_types :: WorkDoneProgressParams { work_done_token : None , } , partial_result_params : lsp_types :: PartialResultParams { partial_result_token : None , } , context : Some ( lsp_types :: CompletionContext { trigger_kind : lsp_types :: CompletionTriggerKind :: TriggerCharacter , trigger_character : Some ( " " . to_string ( ) ) , } ) , } ; c . bench_function ( " " , | b | { b . iter ( | | { block_on ( black_box ( server . completion ( params . clone ( ) ) ) ) . unwrap ( ) . unwrap ( ) ; } ) } ) ; }
Benchmark the response for a package completion
Benchmark the response for a package completion
c
&mut Criterion