[Webkit-unassigned] [Bug 202069] New: clang-tidy: Fix unnecessary copy/ref churn of for loop variables in WTF/JavaScriptCore

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 20 19:21:50 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=202069

            Bug ID: 202069
           Summary: clang-tidy: Fix unnecessary copy/ref churn of for loop
                    variables in WTF/JavaScriptCore
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ddkilzer at webkit.org
                CC: joepeck at webkit.org

Running clang-tidy on WTF and JavaScriptCore resulted in these potential performance improvements to prevent object copies or reference churn in for loop variables:

Source/WTF/wtf/AggregateLogger.h:107:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto logger : m_loggers) {
                  ^
             const  &
--
Source/JavaScriptCore/parser/Parser.h:333:23: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
            for (auto entry : m_lexicalVariables) {
                      ^
                 const  &
--
Source/JavaScriptCore/./inspector/remote/cocoa/RemoteInspectorCocoa.mm:242:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto targetConnection : m_targetConnectionMap.values())
              ^
         const  &
--
Source/JavaScriptCore/./inspector/remote/cocoa/RemoteInspectorCocoa.mm:350:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto targetConnection : m_targetConnectionMap.values())
              ^
         const  &
--
Source/JavaScriptCore/./inspector/remote/cocoa/RemoteInspectorCocoa.mm:440:34: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (RetainPtr<NSDictionary> listing : m_targetListingMap.values()) {
                                 ^
         const                  &
--
Source/JavaScriptCore/./bytecode/CodeBlock.cpp:884:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto setEntry : set) {
                  ^
             const  &
--
Source/JavaScriptCore/./bytecompiler/BytecodeGenerator.cpp:2316:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto pair : activationValuesToCopyOver) {
                  ^
             const  &
--
Source/JavaScriptCore/./dfg/DFGGraph.cpp:549:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto pair : m_rootToArguments)
                  ^
             const  &
--
Source/JavaScriptCore/./inspector/agents/InspectorAgent.cpp:123:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto domainName : extraDomains)
              ^
         const  &
--
Source/JavaScriptCore/./runtime/ProxyObject.cpp:1059:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto propertyName : trapResult) {
                  ^
             const  &
--
Source/JavaScriptCore/./runtime/ProxyObject.cpp:1070:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto propertyName : trapResult)
                  ^
             const  &
--
Source/JavaScriptCore/./runtime/SamplingProfiler.cpp:1016:23: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
            for (auto profile : *profilesToReport)
                      ^
                 const  &
--
Source/JavaScriptCore/./runtime/SamplingProfiler.cpp:1069:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto entry : functionCounts) {
                  ^
             const  &
--
Source/JavaScriptCore/./runtime/SamplingProfiler.cpp:1149:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto entry : bytecodeCounts) {
                  ^
             const  &
--
Source/JavaScriptCore/./runtime/TypeSet.cpp:500:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto field : currentShape->m_fields)
                  ^
             const  &
--
Source/JavaScriptCore/./runtime/TypeSet.cpp:502:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto field : currentShape->m_optionalFields)
                  ^
             const  &
--
Source/JavaScriptCore/./runtime/TypeSet.cpp:541:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto field : a->m_fields) {
              ^
         const  &
--
Source/JavaScriptCore/./runtime/TypeSet.cpp:548:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto field : b->m_fields) {
              ^
         const  &
--
Source/JavaScriptCore/./runtime/TypeSet.cpp:555:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto field : a->m_optionalFields)
              ^
         const  &
--
Source/JavaScriptCore/./runtime/TypeSet.cpp:557:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto field : b->m_optionalFields)
              ^
         const  &

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190921/8b5bf99c/attachment.html>


More information about the webkit-unassigned mailing list