Commit d635a49e authored by Rosen Penev's avatar Rosen Penev Committed by Facebook Github Bot

Change several for ranges to const reference (#1296)

Summary:
Found with performance-for-range-copy
Signed-off-by: default avatarRosen Penev <rosenp@gmail.com>
Pull Request resolved: https://github.com/facebook/folly/pull/1296

Reviewed By: markisaa

Differential Revision: D19258365

Pulled By: yfeldblum

fbshipit-source-id: aa516b18fc2e2405c57ab92fc000a57262dbf96a
parent 647ad236
...@@ -217,7 +217,7 @@ void IOThreadPoolExecutor::stopThreads(size_t n) { ...@@ -217,7 +217,7 @@ void IOThreadPoolExecutor::stopThreads(size_t n) {
ioThread->eventBase->terminateLoopSoon(); ioThread->eventBase->terminateLoopSoon();
} }
} }
for (auto thread : stoppedThreads) { for (const auto& thread : stoppedThreads) {
stoppedThreads_.add(thread); stoppedThreads_.add(thread);
threadList_.remove(thread); threadList_.remove(thread);
} }
......
...@@ -270,7 +270,7 @@ ThreadPoolExecutor::PoolStats ThreadPoolExecutor::getPoolStats() const { ...@@ -270,7 +270,7 @@ ThreadPoolExecutor::PoolStats ThreadPoolExecutor::getPoolStats() const {
ThreadPoolExecutor::PoolStats stats; ThreadPoolExecutor::PoolStats stats;
size_t activeTasks = 0; size_t activeTasks = 0;
size_t idleAlive = 0; size_t idleAlive = 0;
for (auto thread : threadList_.get()) { for (const auto& thread : threadList_.get()) {
if (thread->idle) { if (thread->idle) {
const std::chrono::nanoseconds idleTime = now - thread->lastActiveTime; const std::chrono::nanoseconds idleTime = now - thread->lastActiveTime;
stats.maxIdleTime = std::max(stats.maxIdleTime, idleTime); stats.maxIdleTime = std::max(stats.maxIdleTime, idleTime);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment