Skip to content

Commit 6de5b36

Browse files
authored
don't copy input std::function in thread_parallel (#9339)
There doesn't seem to be any reason to copy this, and it's inefficient to do so.
1 parent 993b36b commit 6de5b36

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

extension/threadpool/thread_parallel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ bool parallel_for(
6565
std::tie(num_tasks, chunk_size) =
6666
calc_num_tasks_and_chunk_size(begin, end, grain_size);
6767

68-
auto task = [f, begin, end, chunk_size](size_t task_id) {
68+
auto task = [&f, begin, end, chunk_size](size_t task_id) {
6969
set_thread_num(task_id);
7070
int64_t local_start = begin + static_cast<int64_t>(task_id) * chunk_size;
7171
if (local_start < end) {

0 commit comments

Comments
 (0)