@@ -1345,11 +1345,11 @@ void SearchWorker::GatherMinibatch2() {
1345
1345
}
1346
1346
1347
1347
void SearchWorker::ProcessPickedTask (int start_idx, int end_idx,
1348
- TaskWorkspace*) {
1348
+ TaskWorkspace* workspace) {
1349
+ auto & history = workspace->history ;
1349
1350
// This code runs multiple passes of work across the same input in order to
1350
1351
// reduce taking/dropping mutexes in quick succession.
1351
- PositionHistory history = search_->played_history_ ;
1352
- history.Reserve (search_->played_history_ .GetLength () + 30 );
1352
+ history = search_->played_history_ ;
1353
1353
1354
1354
// First pass - Extend nodes.
1355
1355
for (int i = start_idx; i < end_idx; i++) {
@@ -1491,15 +1491,15 @@ void SearchWorker::PickNodesToExtendTask(Node* node, int base_depth,
1491
1491
// with tasks.
1492
1492
// TODO: pre-reserve visits_to_perform for expected depth and likely maximum
1493
1493
// width. Maybe even do so outside of lock scope.
1494
- std::vector<std::unique_ptr<std::array<int , 256 >>> visits_to_perform;
1495
1494
auto & vtp_buffer = workspace->vtp_buffer ;
1496
- visits_to_perform.reserve (30 );
1497
- std::vector<int > vtp_last_filled;
1498
- vtp_last_filled.reserve (30 );
1499
- std::vector<int > current_path;
1500
- current_path.reserve (30 );
1501
- std::vector<Move> moves_to_path = moves_to_base;
1502
- moves_to_path.reserve (30 );
1495
+ auto & visits_to_perform = workspace->visits_to_perform ;
1496
+ visits_to_perform.clear ();
1497
+ auto & vtp_last_filled = workspace->vtp_last_filled ;
1498
+ vtp_last_filled.clear ();
1499
+ auto & current_path = workspace->current_path ;
1500
+ current_path.clear ();
1501
+ auto & moves_to_path = workspace->moves_to_path ;
1502
+ moves_to_path = moves_to_base;
1503
1503
// Sometimes receiver is reused, othertimes not, so only jump start if small.
1504
1504
if (receiver->capacity () < 30 ) {
1505
1505
receiver->reserve (receiver->size () + 30 );
0 commit comments