Changing Compiler Optimizations Had No Affect

While doing coremark comparisons (which I reported in post Coremark Comparision - UNO R4 / UNO R4 WiFi - Arduino Forum I tried to run the coremark with the default -Os and -O2 by changing -Os in platforms.txt to -O2 but it appears it has no affect on performance as with other boards I tested:

Uno R4 WiFi (48Mhz, -0s) -  81.81
Uno R4 WiFi (48Mhz, -02) -  81.81
UnoR4 Minima (-02) - 106.75
UnoR4 Minima (-0s) - 106.75

No change. Yes I verifed that it actually changed by looking at verbose compilation and I also restarted the IDE between changes.

Changing from -Os to -O2 with other boards show a big difference:

Teensy 3.2 (48Mhz -0s)  -  86.23
Teensy 3.2 (48Mhz -02)  - 116.07
Feather M0 (48Mhz -0s)  -   48.61
Feather M0 (48Mhz -02)  -   83.85
CH32V307 Eval(48Mhz -0s) - 91.80
CH32V307 Eval(48Mhz -02) - 116.52

What am I missing or is it not possible to change optimization level?

Why did you create a new topic regarding the almost same subject? It is a violation of the forum rules.

The other thread was regarding Coremark comparisons. This is specific to the issue regarding changing Compiler Optimizations. If I were to create an issue it would be for this not for Coremark Comparisons. I don't believe its incorrect to zero in on the actual issue.

It is a very strange result.
Are you sure the option really changed? Check in the output of the arduino IDE - the compilation line with all the options is visible there

Just checked and looks like it changed:

"C:\\Users\\Merli\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/**arm-none-eabi-g++" -c -w -O2** -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DNO_USB -DBACKTRACE_SUPPORT -DARDUINO_UNOR4_WIFI -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\Merli\\AppData\\Local\\Temp\\arduino\\sketches\\B2F7226DA9EDA29A3DA9FBF498BD045B/CoreMark.ino\"" -DARDUINO_UNOWIFIR4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\Merli\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\Merli\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\Merli\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\Merli\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\Merli\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\Merli\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4" "-iprefixC:\\Users\\Merli\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\Merli\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/includes.txt" "C:\\Users\\Merli\\AppData\\Local\\Temp\\arduino\\sketches\\B2F7226DA9EDA29A3DA9FBF498BD045B\\sketch\\CoreMark.ino.cpp" -o nul

Checked the other lines as well but didn't want to clutter the message. There are a bunch of other lines that show 0s has be changed to O2

Except that you made the other thread about compiler optimizations as well.

It is OK to make separate forum topics for discrete aspects of general subject. However, you must keep the two topics discrete, which you failed to do from the start.

Even when the topics start out on discrete subjects, they have a tendency to converge to parallel discussion over time. Parallel discussions are harmful because they waste the time of the helpers who unknowingly duplicate the previous efforts from the other topic. For this reason, you must manage the scope of the discussion to prevent this from happening. If discussion starts to stray into the territory of the other topic, then redirect the participants over to the other to continue that discussion.

I moved all the discussion about the effect of changing compiler optimization flags to this topic. From here on, the other topic will be used exclusively for discussing the CoreMark results with the stock compilation patterns and this topic used exclusively for discussing the apparent lack of effect from changing compiler optimization flags.

If I see more convergence then I'll have to merge the two topics.

Yes Principal. Please close this topic. Probably should have been a Github issue anyway. If I get inspired to do anything more with these boards I will report any issues via Github right now lost interest in these boards.

In order to make all relevant information available to any who are interested in this subject, I'll share a link to the GitHub issue here:

1 Like