Changeset View
Changeset View
Standalone View
Standalone View
src/bench/rpc_mempool.cpp
Show All 19 Lines | pool.addUnchecked(CTxMemPoolEntry(tx, fee, /* time */ 0, | ||||
/* spendsCoinbase */ false, | /* spendsCoinbase */ false, | ||||
/* sigOpCount */ 1, lp)); | /* sigOpCount */ 1, lp)); | ||||
} | } | ||||
static void RpcMempool(benchmark::State &state) { | static void RpcMempool(benchmark::State &state) { | ||||
CTxMemPool pool; | CTxMemPool pool; | ||||
LOCK2(cs_main, pool.cs); | LOCK2(cs_main, pool.cs); | ||||
for (int i = 0; i < 1000; ++i) { | for (int i = 0; i < 10000; i++) { | ||||
CMutableTransaction tx = CMutableTransaction(); | CMutableTransaction tx = CMutableTransaction(); | ||||
tx.vin.resize(1); | tx.vin.resize(100); | ||||
tx.vin[0].scriptSig = CScript() << OP_1; | for (int j = 0; j < 100; j++) { | ||||
tx.vout.resize(1); | tx.vin[j].scriptSig = CScript() << OP_1; | ||||
tx.vout[0].scriptPubKey = CScript() << OP_1 << OP_EQUAL; | } | ||||
tx.vout[0].nValue = i * COIN; | |||||
tx.vout.resize(100); | |||||
for (int j = 0; j < 100; j++) { | |||||
tx.vout[j].scriptPubKey = CScript() << OP_1 << OP_EQUAL; | |||||
tx.vout[j].nValue = i * COIN; | |||||
} | |||||
const CTransactionRef tx_r{MakeTransactionRef(tx)}; | const CTransactionRef tx_r{MakeTransactionRef(tx)}; | ||||
AddTx(tx_r, /* fee */ i * COIN, pool); | AddTx(tx_r, /* fee */ i * COIN, pool); | ||||
} | } | ||||
while (state.KeepRunning()) { | while (state.KeepRunning()) { | ||||
(void)MempoolToJSON(pool, /*verbose*/ true); | (void)MempoolToJSON(pool, /*verbose*/ true); | ||||
} | } | ||||
} | } | ||||
BENCHMARK(RpcMempool, 40); | BENCHMARK(RpcMempool, 3); |