aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bench/checkqueue.cpp5
-rw-r--r--src/checkqueue.h10
-rw-r--r--src/test/fuzz/checkqueue.cpp6
3 files changed, 3 insertions, 18 deletions
diff --git a/src/bench/checkqueue.cpp b/src/bench/checkqueue.cpp
index 41a4a216bf..8ad6fde6bf 100644
--- a/src/bench/checkqueue.cpp
+++ b/src/bench/checkqueue.cpp
@@ -29,7 +29,6 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
struct PrevectorJob {
prevector<PREVECTOR_SIZE, uint8_t> p;
- PrevectorJob() = default;
explicit PrevectorJob(FastRandomContext& insecure_rand){
p.resize(insecure_rand.randrange(PREVECTOR_SIZE*2));
}
@@ -37,10 +36,6 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
{
return true;
}
- void swap(PrevectorJob& x) noexcept
- {
- p.swap(x.p);
- };
};
CCheckQueue<PrevectorJob> queue {QUEUE_BATCH_SIZE};
// The main thread should be counted to prevent thread oversubscription, and
diff --git a/src/checkqueue.h b/src/checkqueue.h
index a4818ad44f..2c21e5f7d0 100644
--- a/src/checkqueue.h
+++ b/src/checkqueue.h
@@ -112,13 +112,9 @@ private:
// * Try to account for idle jobs which will instantly start helping.
// * Don't do batches smaller than 1 (duh), or larger than nBatchSize.
nNow = std::max(1U, std::min(nBatchSize, (unsigned int)queue.size() / (nTotal + nIdle + 1)));
- vChecks.resize(nNow);
- for (unsigned int i = 0; i < nNow; i++) {
- // We want the lock on the m_mutex to be as short as possible, so swap jobs from the global
- // queue to the local batch vector instead of copying.
- vChecks[i].swap(queue.back());
- queue.pop_back();
- }
+ auto start_it = queue.end() - nNow;
+ vChecks.assign(std::make_move_iterator(start_it), std::make_move_iterator(queue.end()));
+ queue.erase(start_it, queue.end());
// Check whether we need to do work at all
fOk = fAllOk;
}
diff --git a/src/test/fuzz/checkqueue.cpp b/src/test/fuzz/checkqueue.cpp
index cd2089de59..429570526f 100644
--- a/src/test/fuzz/checkqueue.cpp
+++ b/src/test/fuzz/checkqueue.cpp
@@ -15,8 +15,6 @@ namespace {
struct DumbCheck {
bool result = false;
- DumbCheck() = default;
-
explicit DumbCheck(const bool _result) : result(_result)
{
}
@@ -25,10 +23,6 @@ struct DumbCheck {
{
return result;
}
-
- void swap(DumbCheck& x) noexcept
- {
- }
};
} // namespace