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

Function run_native_postgres_speed_sqlx_benchmark

xtask/src/main.rs:2448–2490  ·  view source on GitHub ↗
(
    conn: &mut sqlx::PgConnection,
    sql_source: SpeedSqlSource,
    open_micros: u128,
    connect_micros: u128,
)

Source from the content-addressed store, hash-verified

2446}
2447
2448async fn run_native_postgres_speed_sqlx_benchmark(
2449 conn: &mut sqlx::PgConnection,
2450 sql_source: SpeedSqlSource,
2451 open_micros: u128,
2452 connect_micros: u128,
2453) -> Result<BenchmarkRun> {
2454 conn.execute(
2455 "DROP TABLE IF EXISTS t1 CASCADE;\
2456 DROP TABLE IF EXISTS t2 CASCADE;\
2457 DROP TABLE IF EXISTS t2_1 CASCADE;\
2458 DROP TABLE IF EXISTS t3 CASCADE;\
2459 DROP TABLE IF EXISTS t3_1 CASCADE;",
2460 )
2461 .await
2462 .context("clear native Postgres speed benchmark tables over SQLx")?;
2463
2464 let mut tests = Vec::new();
2465 for case in speed_cases(1.0, sql_source)? {
2466 let started = Instant::now();
2467 conn.execute(case.sql.as_str()).await.with_context(|| {
2468 format!(
2469 "execute native Postgres speed benchmark {} over SQLx",
2470 case.id
2471 )
2472 })?;
2473 tests.push(single_sample_result(
2474 case.id,
2475 case.label,
2476 "seconds",
2477 case.operation_count,
2478 started.elapsed(),
2479 ));
2480 }
2481 Ok(BenchmarkRun {
2482 suite: "speed",
2483 mode: "native_postgres_sqlx",
2484 description: "Native Postgres speed suite over TCP using one SQLx connection.",
2485 open_micros,
2486 connect_micros: Some(connect_micros),
2487 setup_micros: 0,
2488 tests,
2489 })
2490}
2491
2492async fn run_pglite_nodefs_speed_sqlx_benchmark(
2493 conn: &mut sqlx::PgConnection,

Callers 1

perf_native_postgresFunction · 0.85

Calls 5

speed_casesFunction · 0.85
single_sample_resultFunction · 0.85
executeMethod · 0.80
pushMethod · 0.80
elapsedMethod · 0.80

Tested by

no test coverage detected