@@ -548,13 +548,11 @@ mod benches {
548548 use test:: { black_box, Bencher } ;
549549
550550 use super :: storage:: NegentropyStorageVector ;
551- use super :: { Bytes , Negentropy } ;
552-
553- const ITEMS_LEN : usize = 100_000 ;
551+ use super :: Bytes ;
554552
555553 #[ bench]
556554 pub fn insert ( bh : & mut Bencher ) {
557- let mut storage_client = NegentropyStorageVector :: new ( ) . unwrap ( ) ;
555+ let mut storage_client = NegentropyStorageVector :: new ( ) ;
558556 bh. iter ( || {
559557 black_box (
560558 storage_client. insert (
@@ -568,83 +566,4 @@ mod benches {
568566 . unwrap ( ) ;
569567 } ) ;
570568 }
571-
572- #[ bench]
573- pub fn final_reconciliation_100_000_items ( bh : & mut Bencher ) {
574- // Client
575- let mut storage_client = NegentropyStorageVector :: new ( ) . unwrap ( ) ;
576- for ( index, item) in generate_combinations ( "abc" , 32 , 2 ) . into_iter ( ) . enumerate ( ) {
577- storage_client
578- . insert ( index as u64 , Bytes :: from_hex ( item) . unwrap ( ) )
579- . unwrap ( ) ;
580- }
581- storage_client. seal ( ) . unwrap ( ) ;
582- let mut client = Negentropy :: new ( storage_client, 0 ) . unwrap ( ) ;
583- let init_output = client. initiate ( ) . unwrap ( ) ;
584-
585- let mut storage_relay = NegentropyStorageVector :: new ( ) . unwrap ( ) ;
586- for ( index, item) in generate_combinations ( "abc" , 32 , ITEMS_LEN )
587- . into_iter ( )
588- . enumerate ( )
589- {
590- storage_relay
591- . insert ( index as u64 , Bytes :: from_hex ( item) . unwrap ( ) )
592- . unwrap ( ) ;
593- }
594- storage_relay. seal ( ) . unwrap ( ) ;
595- let mut relay = Negentropy :: new ( storage_relay, 0 ) . unwrap ( ) ;
596- let reconcile_output = relay. reconcile ( & init_output) . unwrap ( ) ;
597-
598- bh. iter ( || {
599- let mut have_ids = Vec :: new ( ) ;
600- let mut need_ids = Vec :: new ( ) ;
601- black_box ( client. reconcile_with_ids ( & reconcile_output, & mut have_ids, & mut need_ids) )
602- . unwrap ( ) ;
603- } ) ;
604- }
605-
606- fn generate_combinations ( characters : & str , length : usize , max : usize ) -> Vec < String > {
607- let mut combinations = Vec :: new ( ) ;
608- let mut current = String :: new ( ) ;
609- generate_combinations_recursive (
610- & mut combinations,
611- & mut current,
612- characters,
613- length,
614- 0 ,
615- max,
616- ) ;
617- combinations
618- }
619-
620- fn generate_combinations_recursive (
621- combinations : & mut Vec < String > ,
622- current : & mut String ,
623- characters : & str ,
624- length : usize ,
625- index : usize ,
626- max : usize ,
627- ) {
628- if length == 0 {
629- combinations. push ( current. clone ( ) ) ;
630- return ;
631- }
632-
633- for char in characters. chars ( ) {
634- if combinations. len ( ) < max {
635- current. push ( char) ;
636- generate_combinations_recursive (
637- combinations,
638- current,
639- characters,
640- length - 1 ,
641- index + 1 ,
642- max,
643- ) ;
644- current. pop ( ) ;
645- } else {
646- return ;
647- }
648- }
649- }
650569}
0 commit comments