diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index e184e415a921..b2597ac8450a 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -32,12 +32,22 @@ jobs: if: matrix.backend == 'postgres' run: | sudo apt-get update - sudo apt-get install -y libpq-dev postgresql - echo "host all all 127.0.0.1/32 md5" > sudo tee -a /etc/postgresql/10/main/pg_hba.conf - sudo service postgresql restart && sleep 3 + sudo apt install gnupg2 -y + curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg + sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + PG_VER=16 + sudo apt-get update + sudo apt-get install -y libpq-dev postgresql-$PG_VER + sudo tee /etc/postgresql/$PG_VER/main/pg_hba.conf <<'EOF' + local all postgres peer + local all all peer + host all all 127.0.0.1/32 trust + host all all ::1/128 trust + EOF + sudo service postgresql start $PG_VER && sleep 3 sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" - sudo service postgresql restart && sleep 3 - echo 'DATABASE_URL=postgres://postgres:postgres@localhost/' >> $GITHUB_ENV + sudo service postgresql restart $PG_VER && sleep 3 + echo 'DATABASE_URL=postgres://postgres:postgres@localhost:5432/' >> $GITHUB_ENV - name: Install sqlite (Linux) if: matrix.backend == 'sqlite' @@ -61,7 +71,7 @@ jobs: - name: Run Benchmarks (Postgres) if: matrix.backend == 'postgres' - run: cargo +stable bench --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 quaint quaint/postgresql quaint/serde-support serde diesel-async diesel-async/postgres wtx" + run: cargo +stable bench --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" - name: Run Benchmarks (Sqlite) if: matrix.backend == 'sqlite' @@ -69,7 +79,7 @@ jobs: - name: Run Benchmarks (Mysql) if: matrix.backend == 'mysql' - run: cargo +stable bench --manifest-path diesel_bench/Cargo.toml --no-default-features --features "mysql sqlx-bench sqlx/mysql tokio rustorm rustorm/with-mysql rustorm_dao rust_mysql futures sea-orm sea-orm/sqlx-mysql criterion/async_tokio quaint quaint/mysql quaint/serde-support serde diesel-async diesel-async/mysql" + run: cargo +stable bench --manifest-path diesel_bench/Cargo.toml --no-default-features --features "mysql sqlx-bench sqlx/mysql tokio rustorm rustorm/with-mysql rustorm_dao rust_mysql futures sea-orm sea-orm/sqlx-mysql criterion/async_tokio serde diesel-async diesel-async/mysql" - name: Push metrics env: diff --git a/diesel_bench/Cargo.toml b/diesel_bench/Cargo.toml index b9663883dd79..e8906c5fd112 100644 --- a/diesel_bench/Cargo.toml +++ b/diesel_bench/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "diesel_bench" version = "0.1.0" -edition = "2018" +edition = "2021" build = "build.rs" autobenches = false @@ -10,22 +10,34 @@ autobenches = false [dependencies] dotenvy = "0.15" -criterion = {version = "0.5", default-features = false, features = ["csv_output", "cargo_bench_support"]} -sqlx = {version = "0.7", features = ["runtime-tokio-rustls"], optional = true} -tokio = {version = "1", optional = true} -rusqlite = {version = "0.29", optional = true} -rust_postgres = {version = "0.19.7", optional = true, package = "postgres"} -rust_mysql = {version = "23.0", optional = true, package = "mysql"} -rustorm = {version = "0.20", optional = true} -rustorm_dao = {version = "0.20", optional = true} -quaint = {version = "=0.2.0-alpha.13", optional = true, features = ["uuid"]} -serde = {version = "1", optional = true, features = ["derive"]} -sea-orm = { git = "https://github.com/SeaQL/sea-orm/", branch = "master", optional = true, features = ["runtime-tokio-rustls"]} -futures = {version = "0.3", optional = true} -diesel-async = {version = "0.4", optional = true, default-features = false} -criterion-perf-events = { version = "0.4", optional = true} -perfcnt = {version = "0.8", optional = true} -wtx = { default-features = false, features = ["atoi", "memchr", "postgres", "simdutf8", "std", "tokio"], optional = true, version = "0.14" } +criterion = { version = "0.5", default-features = false, features = [ + "csv_output", + "cargo_bench_support", +] } +sqlx = { version = "0", features = ["runtime-tokio-rustls"], optional = true } +tokio = { version = "1", optional = true, features = ["rt-multi-thread"] } +rusqlite = { version = "0.29", optional = true } +rust_postgres = { version = "0.19.7", optional = true, package = "postgres" } +rust_mysql = { version = "23.0", optional = true, package = "mysql" } +rustorm = { version = "0.20", optional = true } +rustorm_dao = { version = "0.20", optional = true } +quaint = { version = "0", optional = true, default-features = false } +serde = { version = "1", optional = true, features = ["derive"] } +sea-orm = { version = "0", optional = true, features = [ + "runtime-tokio-rustls", +] } +futures = { version = "0.3", optional = true } +diesel-async = { version = "0", optional = true, default-features = false } +criterion-perf-events = { version = "0.4", optional = true } +perfcnt = { version = "0.8", optional = true } +wtx = { default-features = false, features = [ + "atoi", + "memchr", + "postgres", + "simdutf8", + "std", + "tokio", +], optional = true, version = "0.14" } [dependencies.diesel] path = "../diesel" @@ -55,6 +67,8 @@ fast_run = [] [patch.crates-io] -quaint = {git = "https://github.com/prisma/prisma-engines", rev = "8f088bb"} -diesel-async = { git = "https://github.com/weiznich/diesel_async", rev = "017ebe2"} -diesel = { path = "../diesel"} +quaint = { git = "https://github.com/prisma/prisma-engines", branch = "main" } +sqlx = { git = "https://github.com/launchbadge/sqlx", branch = "main" } +sea-orm = { git = "https://github.com/SeaQL/sea-orm", branch = "master" } +diesel-async = { git = "https://github.com/weiznich/diesel_async", branch = "main" } +diesel = { path = "../diesel" } diff --git a/diesel_bench/benches/wtx.rs b/diesel_bench/benches/wtx.rs index 565bffebb3bf..cd4e86b80bcc 100644 --- a/diesel_bench/benches/wtx.rs +++ b/diesel_bench/benches/wtx.rs @@ -278,7 +278,7 @@ async fn connection() -> Executor { } async fn insert_posts(conn: &mut Executor) { - let mut users_ids = Vec::with_capacity(N); + let mut users_ids: Vec = Vec::with_capacity(N); conn.fetch_many_with_stmt("SELECT id FROM users", (), |record| { users_ids.push(record.decode(0).unwrap()); Ok(())