@@ -22,8 +22,8 @@ use sqlite::Error;
2222use std:: fs;
2323use std:: path:: Path ;
2424
25- const QUERY_BENCH_KITE_SQL_PATH : & ' static str = "./kitesql_bench" ;
26- const QUERY_BENCH_SQLITE_PATH : & ' static str = "./sqlite_bench" ;
25+ const QUERY_BENCH_KITE_SQL_PATH : & str = "./kitesql_bench" ;
26+ const QUERY_BENCH_SQLITE_PATH : & str = "./sqlite_bench" ;
2727const TABLE_ROW_NUM : u64 = 200_000 ;
2828
2929fn query_cases ( ) -> Vec < ( & ' static str , & ' static str ) > {
@@ -62,9 +62,9 @@ fn init_kitesql_query_bench() -> Result<(), DatabaseError> {
6262}
6363
6464fn init_sqlite_query_bench ( ) -> Result < ( ) , Error > {
65- let connection = sqlite:: open ( QUERY_BENCH_SQLITE_PATH . to_owned ( ) ) ?;
65+ let connection = sqlite:: open ( QUERY_BENCH_SQLITE_PATH ) ?;
6666
67- let _ = connection. execute ( "create table t1 (c1 int primary key, c2 int)" ) ?;
67+ connection. execute ( "create table t1 (c1 int primary key, c2 int)" ) ?;
6868
6969 let pb = ProgressBar :: new ( TABLE_ROW_NUM ) ;
7070 pb. set_style (
@@ -73,7 +73,7 @@ fn init_sqlite_query_bench() -> Result<(), Error> {
7373 . unwrap ( ) ,
7474 ) ;
7575 for i in 0 ..TABLE_ROW_NUM {
76- let _ = connection. execute ( format ! ( "insert into t1 values({}, {})" , i, i + 1 ) ) ?;
76+ connection. execute ( format ! ( "insert into t1 values({i }, {})" , i + 1 ) . as_str ( ) ) ?;
7777 pb. set_position ( i + 1 ) ;
7878 }
7979 pb. finish_with_message ( "Insert completed!" ) ;
@@ -91,16 +91,14 @@ fn path_exists_and_is_directory(path: &str) -> bool {
9191fn query_on_execute ( c : & mut Criterion ) {
9292 if !Path :: new ( QUERY_BENCH_SQLITE_PATH ) . exists ( ) {
9393 println ! (
94- "SQLITE: The table is not initialized and data insertion is started. => {}" ,
95- TABLE_ROW_NUM
94+ "SQLITE: The table is not initialized and data insertion is started. => {TABLE_ROW_NUM}"
9695 ) ;
9796
9897 init_sqlite_query_bench ( ) . unwrap ( ) ;
9998 }
10099 if !path_exists_and_is_directory ( QUERY_BENCH_KITE_SQL_PATH ) {
101100 println ! (
102- "KiteSQL: The table is not initialized and data insertion is started. => {}" ,
103- TABLE_ROW_NUM
101+ "KiteSQL: The table is not initialized and data insertion is started. => {TABLE_ROW_NUM}"
104102 ) ;
105103
106104 init_kitesql_query_bench ( ) . unwrap ( ) ;
@@ -111,16 +109,18 @@ fn query_on_execute(c: &mut Criterion) {
111109 println ! ( "Table initialization completed" ) ;
112110
113111 for ( name, case) in query_cases ( ) {
114- c. bench_function ( format ! ( "KiteSQL: {} by '{}'" , name, case) . as_str ( ) , |b| {
112+ let kite_label = format ! ( "KiteSQL: {name} by '{case}'" ) ;
113+ c. bench_function ( & kite_label, |b| {
115114 b. iter ( || {
116115 for tuple in database. run ( case) . unwrap ( ) {
117116 let _ = tuple. unwrap ( ) ;
118117 }
119118 } )
120119 } ) ;
121120
122- let connection = sqlite:: open ( QUERY_BENCH_SQLITE_PATH . to_owned ( ) ) . unwrap ( ) ;
123- c. bench_function ( format ! ( "SQLite: {} by '{}'" , name, case) . as_str ( ) , |b| {
121+ let connection = sqlite:: open ( QUERY_BENCH_SQLITE_PATH ) . unwrap ( ) ;
122+ let sqlite_label = format ! ( "SQLite: {name} by '{case}'" ) ;
123+ c. bench_function ( & sqlite_label, |b| {
124124 b. iter ( || {
125125 for row in connection. prepare ( case) . unwrap ( ) {
126126 let _ = row. unwrap ( ) ;
0 commit comments