MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / run_native_postgres_rtt_sqlx_benchmark

Function run_native_postgres_rtt_sqlx_benchmark

xtask/src/main.rs:2361–2404  ·  view source on GitHub ↗
(
    conn: &mut sqlx::PgConnection,
    iterations: usize,
    open_micros: u128,
    connect_micros: u128,
)

Source from the content-addressed store, hash-verified

2359}
2360
2361async fn run_native_postgres_rtt_sqlx_benchmark(
2362 conn: &mut sqlx::PgConnection,
2363 iterations: usize,
2364 open_micros: u128,
2365 connect_micros: u128,
2366) -> Result<BenchmarkRun> {
2367 let setup_started = Instant::now();
2368 conn.execute(rtt_setup_sql())
2369 .await
2370 .context("execute native Postgres RTT setup over SQLx")?;
2371 let setup_micros = setup_started.elapsed().as_micros();
2372
2373 let mut tests = Vec::new();
2374 for case in rtt_cases() {
2375 let mut samples = Vec::with_capacity(iterations);
2376 for _ in 0..iterations {
2377 let started = Instant::now();
2378 conn.execute(case.sql.as_str()).await.with_context(|| {
2379 format!(
2380 "execute native Postgres RTT benchmark {} over SQLx",
2381 case.id
2382 )
2383 })?;
2384 samples.push(started.elapsed().as_micros());
2385 }
2386 tests.push(samples_result(
2387 case.id,
2388 format!("Test {}: {}", case.id, case.label),
2389 "milliseconds",
2390 iterations,
2391 samples,
2392 ));
2393 }
2394
2395 Ok(BenchmarkRun {
2396 suite: "rtt",
2397 mode: "native_postgres_sqlx",
2398 description: "Native Postgres over TCP using one long-lived SQLx connection.",
2399 open_micros,
2400 connect_micros: Some(connect_micros),
2401 setup_micros,
2402 tests,
2403 })
2404}
2405
2406async fn run_pglite_nodefs_rtt_sqlx_benchmark(
2407 conn: &mut sqlx::PgConnection,

Callers 1

perf_native_postgresFunction · 0.85

Calls 6

rtt_setup_sqlFunction · 0.85
rtt_casesFunction · 0.85
samples_resultFunction · 0.85
executeMethod · 0.80
elapsedMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected