@@ -7,7 +7,7 @@ use tokio::runtime::Runtime;
7
7
use tokio_postgres:: { Client , NoTls } ;
8
8
9
9
fn setup ( ) -> ( Client , Runtime ) {
10
- let runtime = Runtime :: new ( ) . unwrap ( ) ;
10
+ let mut runtime = Runtime :: new ( ) . unwrap ( ) ;
11
11
let ( client, conn) = runtime
12
12
. block_on ( tokio_postgres:: connect (
13
13
"host=localhost port=5433 user=postgres" ,
@@ -19,7 +19,7 @@ fn setup() -> (Client, Runtime) {
19
19
}
20
20
21
21
fn query_prepared ( c : & mut Criterion ) {
22
- let ( client, runtime) = setup ( ) ;
22
+ let ( client, mut runtime) = setup ( ) ;
23
23
let statement = runtime. block_on ( client. prepare ( "SELECT $1::INT8" ) ) . unwrap ( ) ;
24
24
c. bench_function ( "runtime_block_on" , move |b| {
25
25
b. iter ( || {
@@ -29,13 +29,13 @@ fn query_prepared(c: &mut Criterion) {
29
29
} )
30
30
} ) ;
31
31
32
- let ( client, runtime) = setup ( ) ;
32
+ let ( client, mut runtime) = setup ( ) ;
33
33
let statement = runtime. block_on ( client. prepare ( "SELECT $1::INT8" ) ) . unwrap ( ) ;
34
34
c. bench_function ( "executor_block_on" , move |b| {
35
35
b. iter ( || executor:: block_on ( client. query ( & statement, & [ & 1i64 ] ) ) . unwrap ( ) )
36
36
} ) ;
37
37
38
- let ( client, runtime) = setup ( ) ;
38
+ let ( client, mut runtime) = setup ( ) ;
39
39
let client = Arc :: new ( client) ;
40
40
let statement = runtime. block_on ( client. prepare ( "SELECT $1::INT8" ) ) . unwrap ( ) ;
41
41
c. bench_function ( "spawned" , move |b| {
0 commit comments