Chris Bracken adb73da22f Use const refs in for loops where reasonable (flutter/engine#17484)
This patch optimizes C++11 range-based for loops where the variable is
copied in each iteration but it would suffice to obtain it by const
reference. This is only applied to loop variables of types that are
expensive to copy which means they are not trivially copyable or have a
non-trivial copy constructor or destructor.

To ensure that it is safe to replace the copy with a const reference
only the following cases are modified:
  * The loop variable is const-qualified.
  * The loop variable is not const, but only const methods or operators
    are invoked on it, or it is used as const reference or value argument
    in constructors or function calls.

This is an application of the internal performance-for-range-copy
clang-tidy analysis.
2020-04-03 11:44:35 -07:00
Languages
Dart 75%
C++ 16.5%
Objective-C++ 2.9%
Java 2.8%
Objective-C 0.7%
Other 1.9%