mirror of
https://github.com/wownero/wownero.git
synced 2026-11-20 15:45:05 +01:00
tx_memory_pool: speedup get_complement() for large requests
Changes complexity from M*N to (2*N+M)*log2(M). The FCMP++ stressnet recently hit mempool sizes of ~55k txs. If the requesting node's mempool is populated, this results in an average of (55000*55000)/2 (about 1.5 billion) comparisons for the responding node. Under this commit, this would be reduced to (55000+55000)*log2(55000) comparisons (about 2.6 million), a 99.83% reduction.
This commit is contained in:
@@ -1850,9 +1850,9 @@ namespace cryptonote
|
||||
m_blockchain_storage.flush_invalid_blocks();
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::get_txpool_complement(const std::vector<crypto::hash> &hashes, std::vector<cryptonote::blobdata> &txes)
|
||||
bool core::get_txpool_complement(std::vector<crypto::hash> hashes, std::vector<cryptonote::blobdata> &txes)
|
||||
{
|
||||
return m_mempool.get_complement(hashes, txes);
|
||||
return m_mempool.get_complement(std::move(hashes), txes);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::update_blockchain_pruning()
|
||||
|
||||
Reference in New Issue
Block a user