-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Size vs. speed optimization in RT compilation #3343
Comments
Just a guess: kernel modules can't be paged or swapped out and userspace RT code is also memlocked IIRC, so on smallish machines 20 years ago maybe it made a difference. Some side effects of undefined behaviour also behave different with -Os and -O2 in my experience. Btw code doesn't need to run "as fast as possible", I would say it should run with predictable and ideally constant runtime. I'm d'accord this should be changed to -O2. |
That would also be my guess. Will change that. On a side note, strictly seen, "ideally constant runtime" is essentially a fantasy using these very complex multi-core, super-scalar, out-of-order, ..., processors and high-level languages. |
Close this issue? |
Not yet. The final fix, changing the Makefile, is still pending. The other PRs were in preparation. I'm also looking into the last of the cppcheck errors. |
Fixed in #3363. |
There are special CFLAGS in the Makefile for real-time code. The CFLAGS include
-Os
line1242:EXTRA_CFLAGS += -fPIC -Os
I am a bit puzzled why this isn't -O2. Or at least propagated from (other) configuration options. It can't be a problem with size. There is plenty memory.
Using size optimize in real-time code is even more puzzling because this code is supposed to run as fast as possible...
Shouldn't this just be changed/fixed to read -O2?
BTW, there is one more instance of -Os in the Makefile (line 254). This also makes no sense.
The text was updated successfully, but these errors were encountered: