mirror of
https://github.com/transmission/transmission
synced 2024-12-22 07:42:37 +00:00
perf: avoid std::advance
in cache.cc (#7025)
This commit is contained in:
parent
fe385259cc
commit
35ef8cf7a0
1 changed files with 2 additions and 3 deletions
|
@ -48,16 +48,15 @@ std::pair<Cache::CIter, Cache::CIter> Cache::find_biggest_span(CIter const begin
|
||||||
for (auto span_begin = begin; span_begin < end;)
|
for (auto span_begin = begin; span_begin < end;)
|
||||||
{
|
{
|
||||||
auto span_end = find_span_end(span_begin, end);
|
auto span_end = find_span_end(span_begin, end);
|
||||||
auto const len = std::distance(span_begin, span_end);
|
|
||||||
|
|
||||||
if (len > biggest_len)
|
if (auto const len = std::distance(span_begin, span_end); len > biggest_len)
|
||||||
{
|
{
|
||||||
biggest_begin = span_begin;
|
biggest_begin = span_begin;
|
||||||
biggest_end = span_end;
|
biggest_end = span_end;
|
||||||
biggest_len = len;
|
biggest_len = len;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::advance(span_begin, len);
|
span_begin = span_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { biggest_begin, biggest_end };
|
return { biggest_begin, biggest_end };
|
||||||
|
|
Loading…
Reference in a new issue