Preview

Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS)

Advanced search

Case study: Source code static analysis for performance issues detection

https://doi.org/10.15514/ISPRAS-2022-34(4)-1

Abstract

Source code static analysis is widely used for program errors detection. Mostly it is used for finding critical issues like security vulnerabilities, critical program defects leading to runtime errors like crash and unexpected behavior of programs. Many SCSA tools are used for checking code conformance to different coding style guides. In this case study we present results of applying SCSA techniques for checking performance coding rules of Huawei and evaluate whether manually fixing found issues in accordance with the guidelines could impact performance, or if the compiler already applies all necessary optimizations during compilation.

About the Authors

Alexander Yurievich GERASIMOV
Chong-Ming Software and Technology Center, Huawei Technologies Co. Ltd.
Russian Federation

Doctor of Philosophy in Computer Sciences, Head of the Program Analysis team of Moscow Research Center of Russian Research Institute of Huawei Company



Alexey Alexeyevich KANAKHIN
Chong-Ming Software and Technology Center, Huawei Technologies Co. Ltd.
Russian Federation

Doctor of Philosophy in Physics of Semiconductors, Senior Research Engineer in Moscow Research Center of Russian Research Institute of Huawei Company 



Petr Alekseevich PRIVALOV
Chong-Ming Software and Technology Center, Huawei Technologies Co. Ltd.
Russian Federation

Master of Science in applied mathematics and physics, Senior Software Engineer at the Program Analysis team of Moscow Research Center of Russian Research Institute of Huawei Company



Andrey Alexandrovich ZHUKOV
Coleman Services
Russian Federation

Master of Science in information and computation systems, member of the Program Analysis team of Moscow Research Center of Russian Research Institute of Huawei Company



Evgenii Arkadievich KAMINSKII
Coleman Services
Russian Federation

Senior developer of the Program Analysis team of Moscow Research Center of Russian Research Institute of Huawei Company 



References

1. GCC, the GNU Compiler Collection. Available at: https://web.archive.org/web/20220913154847/http://gcc.gnu.org/, accessed 2022-09-13.

2. The State of Developer Ecosystem 2021: C++. Available at: https://web.archive.org/web/20220609172327/https://www.jetbrains.com/lp/devecosystem-2021/cpp/, accessed 2022-06-09.

3. GCC: Options That Control Optimization. Available at: https://web.archive.org/web/20220910030424/https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html, accessed 2022-09-10.

4. Yosys Open SYnthesis Suite. Available at: https://github.com/YosysHQ/yosys, accessed 2022-09-10.

5. Compiler Explorer. Available at: https://godbolt.org/

6. V. Lazarenko. From Switch Statement Down to Machine Code. Available at: https://web.archive.org/web/20220313040503/http://lazarenko.me/switch/, accessed 2022-03-13.

7. SEI CERT C Coding standard. API00-C. Functions should validate their parameters. Available at: https://wiki.sei.cmu.edu/confluence/display/c/API00-C.+Functions+should+validate+their+parameters, accessed 2022-03-13.

8. J.E. Smith. A study of branch prediction strategies. In Proc. of the 8th Annual Symposium on Computer Architecture, 1981, pp. 135-148.

9. SPARC International. Available at: https://sparc.org/, accessed 2022-03-13.

10. D. Patterson. Computer Organization and Design, Fifth Edition. ‎ Morgan Kaufmann, 2013, 800 p.

11. ISO/IEC N4860 – Programming Language C++. [Working draft]. Available at: https://web.archive.org/web/20220901051849/https://isocpp.org/files/papers/N4860.pdf, accessed 2022-09-01.

12. C++ Core Guidelines. Available at: https://web.archive.org/web/20220913102723/https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines, accessed 2022-09-13.

13. B. Stroustrup. Foundations of C++. Lecture Notes in Computer Science, vol. 7211, 2013, pp. 1-25.

14. Electronic Arts Standard Template Library. Available at: https://github.com/electronicarts/EASTL/blob/master/doc/FAQ.md#info11-what-c-language-features-does-eastl-use-eg-virtual-functions, accessed 2022-09-01.

15. Google C++ Style Guide. Available at: https://google.github.io/styleguide/cppguide.html#Run-Time_Type_Information__RTTI_, accessed 2022-09-01.

16. LLVM Coding Standards. Available at: https://llvm.org/docs/CodingStandards.html#do-not-use-rtti-or-exceptions, accessed 2022-09-01.

17. S. Milton, H.W. Schmidt. Dynamic Dispatch in Object-Oriented Languages. Australian National University, TR-CS-94-02, 1994.

18. J.R. Bandela. Polymorphism != Virtual. Flexible Runtime Polymorphysm wihtout Inheritance. In the CppCon 2019 Presentation Materials, 2019, available at: https://github.com/CppCon/CppCon2019/blob/master/Presentations/polymorphism__virtual/polymorphism__virtual__john_bandela__cppcon_2019.pdf, accessed 2022-09-01.

19. L. Dionne. Runtime polymorphism: back to the basics. In the CppCon 2017 Presentation Materials, 2017, available at: https://github.com/CppCon/CppCon2017/blob/master/Presentations/Runtime%20Polymorphism%20-%20Back%20to%20the%20Basics/Runtime%20Polymorphism%20-%20Back%20to%20the%20Basics%20-%20Louis%20Dionne%20-%20CppCon%202017.pdf, accessed 2022-09-01.

20. PVS-Studio. Available at: https://pvs-studio.com/en/docs/warnings/#MicroOptimizationsCPP, accessed 2022-09-01.

21. CPPCheck. Available at: https://github.com/danmar/cppcheck, accessed 2022-09-01.

22. A. Nistor, P-C. Chang et al. Caramel: detecting and fixing performance problems that have non-intrusive fixes. In Proc. of the 37th International Conference on Software Engineering, vol. 1, 2015, pp. 902-912

23. A. Nistor, L. Song et al. Toddler: Detecting Performance Problems via Similar Memory-Access Patters. In Proc. of the 35th International Conference on Software Engineering (ICSE), 2013, pp. 562-571.

24. O. Olivio, I. Dilling, C. Lin. Static detection of asymptotic performance bugs in collection traversals. In Proc. of the ACM SIGPLAN Conference on Programming Language Design and Implementation, 2016, pp. 369-378.

25. L. Song, S. Lu. Performance Diagnostics for Inefficient Loops. In Proc. of the IEEE/ACM 39th International Conference on Software Engineering: Software Engineering Education and Training Track (ICSE-SEET), 2017, pp. 370-380.

26. SEI CERT C Coding Standard. 3 Recommendations. Rec. 14. Concurrency (CON). CON02-C. Do not use volatile as a synchronization primitive. Available at: https://web.archive.org/web/20220916130555/https://wiki.sei.cmu.edu/confluence/display/c/CON02-C.+Do+not+use+volatile+as+a+synchronization+primitive, accessed 2022-09-16.

27. ISO International Standard ISO/IEC 9899:201x – Programming Language C. [Working draft]. Geneva, Switzerland: International Organization for Standardization (ISO). Available at: https://web.archive.org/web/20220831233111/https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf, accessed 2022-08-31.

28. XL C/C++ for Linux: -qrtti, -fno-rtti. Available at: https://web.archive.org/web/20220916134348/https://www.ibm.com/docs/en/xl-c-and-cpp-linux/13.1.1?topic=descriptions-qrtti-fno-rtti-qnortti-only, accessed 2022-09-16.


Review

For citations:


GERASIMOV A.Yu., KANAKHIN A.A., PRIVALOV P.A., ZHUKOV A.A., KAMINSKII E.A. Case study: Source code static analysis for performance issues detection. Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS). 2022;34(4):7-20. https://doi.org/10.15514/ISPRAS-2022-34(4)-1



Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.


ISSN 2079-8156 (Print)
ISSN 2220-6426 (Online)