https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125675
Bug ID: 125675
Summary: Low performance in modules compared with classical
includes only fixed with -fno-inline
-fno-inline-functions -fno-inline-small-functions
-fno-default-inline
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jose.gomez.lopez at gmail dot com
Target Milestone: ---
I created two versions of an baremetal xtensa-lx106 application (without
standard library)
1. Using classical includes
2. Using C++20 modules
3. Using C++20 modules but compiled with -fno-inline -fno-inline-functions
-fno-inline-small-functions -fno-default-inline
I measured the energy consumption related to software implementation during 12
hours in mW
| Use Case | Energy consumption in 12 h (mW) | Binary size (bytes) |
|----------|---------------------------------|---------------------|
| Case 1 | 124 | 23396 |
| Case 2 | 235 | 27886 |
| Case 3 | 125 | 28224 |
I would expect the performance of Cases 1 and 2 should be the same, I think in
Case 2 inlining is applied but not correctly. Case 1 and Case 3 (forcing
removing inlining) have the same performance.
For more detailed explanation and code look at
https://github.com/jgomezlopez/esp8266_no_sdk_baremetal_cpp