diff --git a/tests/abc/testPerformance.nim b/tests/abc/testPerformance.nim index 2218675..e560e09 100644 --- a/tests/abc/testPerformance.nim +++ b/tests/abc/testPerformance.nim @@ -1,5 +1,6 @@ import std/times import std/strutils +import std/random import abc/txstore import ./basics import ./alicebob @@ -68,6 +69,14 @@ suite "Performance": inc index statistic "transactions per second", count * 100 + test "↑↑↑ add transactions in random order ↑↑↑": + let transactions = generateTransactions(10_000) + var store = TxStore.new(Transaction.genesis) + for _ in 0..<4: + let count = repeat(initDuration(milliseconds = 10)): + store.add(transactions.sample) + statistic "transactions per second", count * 100 + proc generateAcks(transactions: openArray[Transaction]): seq[Ack] = var ack: ?Ack for tx in transactions: