You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King, III (JIRA)" <ji...@apache.org> on 2015/03/31 22:54:52 UTC

[jira] [Updated] (THRIFT-3067) C++ cppcheck performance related warnings

     [ https://issues.apache.org/jira/browse/THRIFT-3067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James E. King, III updated THRIFT-3067:
---------------------------------------
    Description: 
These are performance-related issues identified by cppcheck that could be cleaned up.  Since these are not logic errors per se, I have marked them as trivial:
{noformat}grep 'performance' /tmp/cppcheck-thrift.issues
[compiler/cpp/src/parse/t_enum.h:47]: (performance) Function parameter 'name' should be passed by reference.
[compiler/cpp/src/parse/t_program.h:72]: (performance) Variable 'name_' is assigned in constructor body. Consider performing initialization in initialization list.
[compiler/cpp/src/parse/t_service.h:48]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[contrib/fb303/TClientInfo.cpp:157] -> [contrib/fb303/TClientInfo.cpp:159]: (performance) Variable 'secs' is reassigned a value before the old one has been used.
[contrib/fb303/cpp/FacebookBase.cpp:101]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[contrib/fb303/cpp/ServiceTracker.cpp:254]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[lib/cpp/src/thrift/concurrency/ThreadManager.cpp:354]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[lib/cpp/src/thrift/concurrency/ThreadManager.cpp:448]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[lib/cpp/src/thrift/concurrency/TimerManager.cpp:122]: (performance) Prefer prefix ++/-- operators for non-primitive types.{noformat}

I also noticed that the TSocket constructor that takes a string argument does so by value instead of by reference.

  was:
These are performance-related issues identified by cppcheck that could be cleaned up.  Since these are not logic errors per se, I have marked them as trivial:
{noformat}grep 'performance' /tmp/cppcheck-thrift.issues
[compiler/cpp/src/parse/t_enum.h:47]: (performance) Function parameter 'name' should be passed by reference.
[compiler/cpp/src/parse/t_program.h:72]: (performance) Variable 'name_' is assigned in constructor body. Consider performing initialization in initialization list.
[compiler/cpp/src/parse/t_service.h:48]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[contrib/fb303/TClientInfo.cpp:157] -> [contrib/fb303/TClientInfo.cpp:159]: (performance) Variable 'secs' is reassigned a value before the old one has been used.
[contrib/fb303/cpp/FacebookBase.cpp:101]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[contrib/fb303/cpp/ServiceTracker.cpp:254]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[lib/cpp/src/thrift/concurrency/ThreadManager.cpp:354]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[lib/cpp/src/thrift/concurrency/ThreadManager.cpp:448]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[lib/cpp/src/thrift/concurrency/TimerManager.cpp:122]: (performance) Prefer prefix ++/-- operators for non-primitive types.{noformat}


> C++ cppcheck performance related warnings
> -----------------------------------------
>
>                 Key: THRIFT-3067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3067
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9.2
>            Reporter: James E. King, III
>            Priority: Trivial
>
> These are performance-related issues identified by cppcheck that could be cleaned up.  Since these are not logic errors per se, I have marked them as trivial:
> {noformat}grep 'performance' /tmp/cppcheck-thrift.issues
> [compiler/cpp/src/parse/t_enum.h:47]: (performance) Function parameter 'name' should be passed by reference.
> [compiler/cpp/src/parse/t_program.h:72]: (performance) Variable 'name_' is assigned in constructor body. Consider performing initialization in initialization list.
> [compiler/cpp/src/parse/t_service.h:48]: (performance) Prefer prefix ++/-- operators for non-primitive types.
> [contrib/fb303/TClientInfo.cpp:157] -> [contrib/fb303/TClientInfo.cpp:159]: (performance) Variable 'secs' is reassigned a value before the old one has been used.
> [contrib/fb303/cpp/FacebookBase.cpp:101]: (performance) Prefer prefix ++/-- operators for non-primitive types.
> [contrib/fb303/cpp/ServiceTracker.cpp:254]: (performance) Prefer prefix ++/-- operators for non-primitive types.
> [lib/cpp/src/thrift/concurrency/ThreadManager.cpp:354]: (performance) Prefer prefix ++/-- operators for non-primitive types.
> [lib/cpp/src/thrift/concurrency/ThreadManager.cpp:448]: (performance) Prefer prefix ++/-- operators for non-primitive types.
> [lib/cpp/src/thrift/concurrency/TimerManager.cpp:122]: (performance) Prefer prefix ++/-- operators for non-primitive types.{noformat}
> I also noticed that the TSocket constructor that takes a string argument does so by value instead of by reference.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)