A final kulcsszó hatásának elemzése a C++ programok teljesítményére

Benjamin Summerton, a PSRayTracing ray tracing system author, analyzed the impact on application performance of using the C++ keyword "final," which was introduced in the C++11 standard. The testing was prompted by claims circulating online that using "final" could improve performance, which were limited to evaluative judgments without concrete results.

Benjamin's testing showed that the performance impact of using "final" heavily depends on the compiler. When built with GCC, performance indeed increased noticeably in a significant number of cases, but when built with Clang and MSVC, performance generally decreased, and more significantly. Moreover, the platform also had a major influence; for instance, performance drops were more evident on systems with an AMD Ryzen 9 6900HX CPU than on systems with an Apple M1 CPU.

A final kulcsszó hatásának elemzése a C++ programok teljesítményére
A final kulcsszó hatásának elemzése a C++ programok teljesítményére

For example, on an AMD Ryzen 9 6900HX system with Ubuntu 23.10, when built with Clang, 90% of tests showed a slowdown of at least 5% when using "final," while in 2.5% of cases, there was an acceleration of at least 5%. For GCC, a 5% slowdown was recorded in 0.9% of cases, while a 5% acceleration occurred in 15.8% of cases. In MSVC, a 5% slowdown was observed in 26.2% of tests, while a 5% acceleration was found in 13.3%. The author of the study concluded that it is necessary to avoid using "final."

Forrás: opennet.ru

Megbízható hosting vásárlása weboldalak számára, DDoS védelemmel, VPS VDS szerverek. 🔥 Megbízható webtárhely vásárlása DDoS védelemmel, VPS VDS szerverek | ProHoster