Skip to content

Commit

Permalink
add tokio-postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
sabify committed Feb 24, 2024
1 parent 7554efa commit 8fa791f
Show file tree
Hide file tree
Showing 4 changed files with 483 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:

- name: Run Benchmarks (Postgres)
if: matrix.backend == 'postgres'
run: cargo +stable bench --no-fail-fast --manifest-path diesel_bench/Cargo.toml --no-default-features --features "postgres sqlx-bench sqlx/postgres rust_postgres futures sea-orm sea-orm/sqlx-postgres criterion/async_tokio serde diesel-async diesel-async/postgres wtx"
run: cargo +stable bench --no-fail-fast --manifest-path diesel_bench/Cargo.toml --no-default-features --features "postgres sqlx-bench sqlx/postgres rust_postgres tokio_postgres futures sea-orm sea-orm/sqlx-postgres criterion/async_tokio serde diesel-async diesel-async/postgres wtx"

- name: Run Benchmarks (Sqlite)
if: matrix.backend == 'sqlite'
Expand Down
1 change: 1 addition & 0 deletions diesel_bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sqlx = { version = "0.7.3", features = [
tokio = { version = "1", optional = true, features = ["rt-multi-thread"] }
rusqlite = { version = "0.30", optional = true }
rust_postgres = { version = "0.19.7", optional = true, package = "postgres" }
tokio_postgres = { version = "0.7.10", optional = true, package = "tokio-postgres" }
rust_mysql = { version = "24.0", optional = true, package = "mysql" }
rustorm = { version = "0.20", optional = true }
rustorm_dao = { version = "0.20", optional = true }
Expand Down
32 changes: 32 additions & 0 deletions diesel_bench/benches/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ mod diesel_benches;
mod mysql_benches;
#[cfg(all(feature = "postgres", feature = "rust_postgres"))]
mod postgres_benches;
#[cfg(all(feature = "postgres", feature = "tokio_postgres"))]
mod tokio_postgres_benches;
#[cfg(feature = "quaint")]
mod quaint_benches;
#[cfg(all(feature = "rusqlite", feature = "sqlite"))]
Expand Down Expand Up @@ -142,6 +144,16 @@ fn bench_trivial_query(c: &mut CriterionType) {
crate::postgres_benches::bench_trivial_query_by_name(b, *i);
});

#[cfg(all(feature = "postgres", feature = "tokio_postgres"))]
group.bench_with_input(BenchmarkId::new("tokio_postgres_by_id", size), size, |b, i| {
crate::tokio_postgres_benches::bench_trivial_query_by_id(b, *i);
});

#[cfg(all(feature = "postgres", feature = "tokio_postgres"))]
group.bench_with_input(BenchmarkId::new("tokio_postgres_by_name", size), size, |b, i| {
crate::tokio_postgres_benches::bench_trivial_query_by_name(b, *i);
});

#[cfg(all(feature = "mysql", feature = "rust_mysql"))]
group.bench_with_input(BenchmarkId::new("mysql_by_id", size), size, |b, i| {
crate::mysql_benches::bench_trivial_query_by_id(b, *i);
Expand Down Expand Up @@ -245,6 +257,16 @@ fn bench_medium_complex_query(c: &mut CriterionType) {
crate::postgres_benches::bench_medium_complex_query_by_name(b, *i);
});

#[cfg(all(feature = "postgres", feature = "tokio_postgres"))]
group.bench_with_input(BenchmarkId::new("tokio_postgres_by_id", size), size, |b, i| {
crate::tokio_postgres_benches::bench_medium_complex_query_by_id(b, *i);
});

#[cfg(all(feature = "postgres", feature = "tokio_postgres"))]
group.bench_with_input(BenchmarkId::new("tokio_postgres_by_name", size), size, |b, i| {
crate::tokio_postgres_benches::bench_medium_complex_query_by_name(b, *i);
});

#[cfg(all(feature = "mysql", feature = "rust_mysql"))]
group.bench_with_input(BenchmarkId::new("mysql_by_id", size), size, |b, i| {
crate::mysql_benches::bench_medium_complex_query_by_id(b, *i);
Expand Down Expand Up @@ -287,6 +309,11 @@ fn bench_loading_associations_sequentially(c: &mut CriterionType) {
crate::postgres_benches::loading_associations_sequentially(b)
});

#[cfg(all(feature = "postgres", feature = "tokio_postgres"))]
group.bench_function("tokio_postgres", |b| {
crate::tokio_postgres_benches::loading_associations_sequentially(b)
});

#[cfg(all(feature = "sqlite", feature = "rusqlite"))]
group.bench_function("rusqlite", |b| {
crate::rusqlite_benches::loading_associations_sequentially(b)
Expand Down Expand Up @@ -358,6 +385,11 @@ fn bench_insert(c: &mut CriterionType) {
crate::postgres_benches::bench_insert(b, *i);
});

#[cfg(all(feature = "postgres", feature = "tokio_postgres"))]
group.bench_with_input(BenchmarkId::new("tokio_postgres", size), size, |b, i| {
crate::tokio_postgres_benches::bench_insert(b, *i);
});

#[cfg(all(feature = "sqlite", feature = "rusqlite"))]
group.bench_with_input(BenchmarkId::new("rusqlite", size), size, |b, i| {
crate::rusqlite_benches::bench_insert(b, *i);
Expand Down
Loading

0 comments on commit 8fa791f

Please sign in to comment.