@@ -4,7 +4,6 @@ use cornucopia::conn::cornucopia_conn;
44use criterion:: { BenchmarkId , Criterion } ;
55use diesel:: { Connection , PgConnection } ;
66use postgres:: { fallible_iterator:: FallibleIterator , Client , NoTls } ;
7- use tokio:: runtime:: Runtime ;
87
98const QUERY_SIZE : & [ usize ] = & [ 1 , 100 , 10_000 ] ;
109const INSERT_SIZE : & [ usize ] = & [ 1 , 100 , 1000 ] ;
@@ -128,23 +127,16 @@ fn prepare_full(client: &mut Client) {
128127fn bench ( c : & mut Criterion ) {
129128 cornucopia:: container:: cleanup ( false ) . ok ( ) ;
130129 cornucopia:: container:: setup ( false ) . unwrap ( ) ;
131- let client = & mut cornucopia_conn ( ) . unwrap ( ) ;
132- let rt: & ' static Runtime = Box :: leak ( Box :: new ( Runtime :: new ( ) . unwrap ( ) ) ) ;
133- let async_client = & mut rt. block_on ( async {
134- let ( client, conn) = tokio_postgres:: connect (
135- "postgresql://postgres:[email protected] :5435/postgres" , 136- NoTls ,
137- )
138- . await
139- . unwrap ( ) ;
140- rt. spawn ( conn) ;
141- client
142- } ) ;
130+ let client = & mut postgres:: Client :: connect (
131+ "postgresql://postgres:[email protected] :5435/postgres" , 132+ NoTls ,
133+ )
134+ . unwrap ( ) ;
135+ let async_client = & mut cornucopia_conn ( ) . unwrap ( ) ;
143136 let conn =
144137 & mut PgConnection :: establish ( "postgresql://postgres:[email protected] :5435/postgres" ) 145138 . unwrap ( ) ;
146-
147- cornucopia:: load_schema ( client, & [ "usage/cornucopia_benches/schema.sql" ] ) . unwrap ( ) ;
139+ cornucopia:: load_schema ( async_client, & [ "execution/cornucopia_benches/schema.sql" ] ) . unwrap ( ) ;
148140 {
149141 let mut group = c. benchmark_group ( "bench_trivial_query" ) ;
150142 for size in QUERY_SIZE {
0 commit comments