forked from launchbadge/sqlx
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
redo changes from abhijeetbhagat:ws-support
- Loading branch information
Showing
7 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
use sqlx::Row; | ||
use sqlx::{postgres::PgRow, Connection}; | ||
use sqlx::{Database, PgConnection, Postgres}; | ||
use sqlx_rt::spawn; | ||
|
||
const URL: &str = "postgresql://paul:pass123@127.0.0.1:8080/jetasap_dev"; | ||
|
||
fn select() { | ||
spawn(async { | ||
let mut conn = <Postgres as Database>::Connection::connect(URL) | ||
.await | ||
.unwrap(); | ||
|
||
let airports = sqlx::query("select * from airports") | ||
.fetch_all(&mut conn) | ||
.await; | ||
}); | ||
} | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
c.bench_function("fib 20", |b| b.iter(|| select())); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters