File tree Expand file tree Collapse file tree 3 files changed +3
-18
lines changed Expand file tree Collapse file tree 3 files changed +3
-18
lines changed Original file line number Diff line number Diff line change @@ -29,18 +29,13 @@ static void CCheckQueueSpeedPrevectorJob(benchmark::Bench& bench)
29
29
30
30
struct PrevectorJob {
31
31
prevector<PREVECTOR_SIZE, uint8_t > p;
32
- PrevectorJob () = default ;
33
32
explicit PrevectorJob (FastRandomContext& insecure_rand){
34
33
p.resize (insecure_rand.randrange (PREVECTOR_SIZE*2 ));
35
34
}
36
35
bool operator ()()
37
36
{
38
37
return true ;
39
38
}
40
- void swap (PrevectorJob& x) noexcept
41
- {
42
- p.swap (x.p );
43
- };
44
39
};
45
40
CCheckQueue<PrevectorJob> queue {QUEUE_BATCH_SIZE};
46
41
// The main thread should be counted to prevent thread oversubscription, and
Original file line number Diff line number Diff line change @@ -112,13 +112,9 @@ class CCheckQueue
112
112
// * Try to account for idle jobs which will instantly start helping.
113
113
// * Don't do batches smaller than 1 (duh), or larger than nBatchSize.
114
114
nNow = std::max (1U , std::min (nBatchSize, (unsigned int )queue.size () / (nTotal + nIdle + 1 )));
115
- vChecks.resize (nNow);
116
- for (unsigned int i = 0 ; i < nNow; i++) {
117
- // We want the lock on the m_mutex to be as short as possible, so swap jobs from the global
118
- // queue to the local batch vector instead of copying.
119
- vChecks[i].swap (queue.back ());
120
- queue.pop_back ();
121
- }
115
+ auto start_it = queue.end () - nNow;
116
+ vChecks.assign (std::make_move_iterator (start_it), std::make_move_iterator (queue.end ()));
117
+ queue.erase (start_it, queue.end ());
122
118
// Check whether we need to do work at all
123
119
fOk = fAllOk ;
124
120
}
Original file line number Diff line number Diff line change @@ -15,8 +15,6 @@ namespace {
15
15
struct DumbCheck {
16
16
bool result = false ;
17
17
18
- DumbCheck () = default ;
19
-
20
18
explicit DumbCheck (const bool _result) : result(_result)
21
19
{
22
20
}
@@ -25,10 +23,6 @@ struct DumbCheck {
25
23
{
26
24
return result;
27
25
}
28
-
29
- void swap (DumbCheck& x) noexcept
30
- {
31
- }
32
26
};
33
27
} // namespace
34
28
You can’t perform that action at this time.
0 commit comments