mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Performance Regression Fix: Pre-Allocate txChanged vector
This commit is contained in:
parent
ec139a5621
commit
ec81881b86
@ -2835,7 +2835,7 @@ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams,
|
||||
UpdateTip(pindexNew, chainparams);
|
||||
|
||||
for(unsigned int i=0; i < pblock->vtx.size(); i++)
|
||||
txChanged.push_back(std::make_tuple(pblock->vtx[i], pindexNew, i));
|
||||
txChanged.emplace_back(pblock->vtx[i], pindexNew, i);
|
||||
|
||||
int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
|
||||
LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001);
|
||||
@ -3019,14 +3019,17 @@ static void NotifyHeaderTip() {
|
||||
bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, const CBlock *pblock) {
|
||||
CBlockIndex *pindexMostWork = NULL;
|
||||
CBlockIndex *pindexNewTip = NULL;
|
||||
std::vector<std::tuple<CTransaction,CBlockIndex*,int>> txChanged;
|
||||
if (pblock)
|
||||
txChanged.reserve(pblock->vtx.size());
|
||||
do {
|
||||
txChanged.clear();
|
||||
boost::this_thread::interruption_point();
|
||||
if (ShutdownRequested())
|
||||
break;
|
||||
|
||||
const CBlockIndex *pindexFork;
|
||||
std::list<CTransaction> txConflicted;
|
||||
std::vector<std::tuple<CTransaction,CBlockIndex*,int> > txChanged;
|
||||
bool fInitialDownload;
|
||||
int nNewHeight;
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user