Skip to content

Commit ec49acf

Browse files
author
Vincent Rouillé
committed
bindingtester: improve LogStack performance by 100x
1 parent 4ae7d03 commit ec49acf

File tree

1 file changed

+7
-1
lines changed
  • foundationdb-bindingtester/src

1 file changed

+7
-1
lines changed

foundationdb-bindingtester/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@ impl StackMachine {
757757
let mut stack_idx = self.stack.len();
758758
let trx_id = self.next_trx_id();
759759
let mut t = trx.take(trx_id);
760+
let mut n = 0;
760761
while let Some(stack_item) = self.maybe_pop().await {
761762
stack_idx -= 1;
762763
let mut key = prefix.clone().into_owned();
@@ -765,8 +766,13 @@ impl StackMachine {
765766

766767
let value = pack(&stack_item.data.unwrap());
767768
t.set(&key, &value[..value.len().min(40000)]);
768-
t = t.commit().await.unwrap().reset();
769+
n += 1;
770+
if n == 100 {
771+
t = t.commit().await.unwrap().reset();
772+
n = 0;
773+
}
769774
}
775+
t = t.commit().await.unwrap().reset();
770776
trx = TransactionState::Transaction(t);
771777
}
772778

0 commit comments

Comments
 (0)