@@ -25,21 +25,20 @@ static DB: LazyLock<NamedTempFile> = LazyLock::new(|| {
2525 db
2626} ) ;
2727
28- #[ divan:: bench( args = [ 1 , 10 , 100 , 1000 ] ) ]
28+ #[ divan:: bench( args = [ 1 , 10 , 100 , 10_000 , 100_000 , 1_000_000 ] , sample_size= 10 ) ]
2929fn store ( n : usize ) {
3030 let db = get_temp ( ) ;
3131
3232 let bytes = OsString :: from_str ( "a" . repeat ( n) . as_ref ( ) ) . unwrap ( ) ;
33- for _ in 0 ..n {
34- let args = StoreArgs {
35- bytes : Some ( bytes. clone ( ) ) ,
36- ..Default :: default ( )
37- } ;
38- store:: execute ( db. path ( ) , args) . expect ( "failed to store" ) ;
39- }
33+ let args = StoreArgs {
34+ bytes : Some ( bytes) ,
35+ ..Default :: default ( )
36+ } ;
37+
38+ store:: execute ( db. path ( ) , args) . expect ( "failed to store" ) ;
4039}
4140
42- #[ divan:: bench( args = [ 1 , 5 , 10 , 25 , 50 , 100 , 1000 ] ) ]
41+ #[ divan:: bench( args = [ 1 , 5 , 10 , 25 , 50 , 100 , 1000 ] , sample_size= 10 ) ]
4342fn list ( n : usize ) {
4443 let path_db = DB . path ( ) ;
4544
@@ -51,18 +50,16 @@ fn list(n: usize) {
5150 list:: execute_without_output ( path_db, args) . expect ( "failed to list" ) ;
5251}
5352
54- #[ divan:: bench( args = [ -100000 , -1 , 0 , 1 , 100000 ] ) ]
53+ #[ divan:: bench( args = [ -100000 , -1 , 0 , 1 , 100000 ] , sample_size= 100 ) ]
5554fn get ( n : isize ) {
5655 let path_db = DB . path ( ) ;
5756
58- for _ in 0 ..100 {
59- let args = GetDelArgs {
60- input : String :: new ( ) ,
61- index : Some ( n) ,
62- } ;
57+ let args = GetDelArgs {
58+ input : String :: new ( ) ,
59+ index : Some ( n) ,
60+ } ;
6361
64- get:: execute_without_output ( path_db, args) . expect ( "failed to get" ) ;
65- }
62+ get:: execute_without_output ( path_db, args) . expect ( "failed to get" ) ;
6663}
6764
6865fn main ( ) {
0 commit comments