Skip to content

Tell GCC to optimize for code size in some .c files - #2202

Merged
albinahlback merged 2 commits into
flintlib:mainfrom
fredrik-johansson:osize
Jan 30, 2025
Merged

Tell GCC to optimize for code size in some .c files#2202
albinahlback merged 2 commits into
flintlib:mainfrom
fredrik-johansson:osize

Conversation

@fredrik-johansson

@fredrik-johansson fredrik-johansson commented Jan 28, 2025

Copy link
Copy Markdown
Collaborator

Some files have large chunks of code that don't need to be optimized for execution speed, so it makes sense to selectively compile with -Os.

This shrinks my libflint.so by 300 KB.

@fredrik-johansson

Copy link
Copy Markdown
Collaborator Author

@albinahlback Does this look OK?

@albinahlback
albinahlback merged commit f62cdb2 into flintlib:main Jan 30, 2025
@albinahlback

Copy link
Copy Markdown
Collaborator

Yes!

@albinahlback

Copy link
Copy Markdown
Collaborator

Perhaps this was not the best solution. For optimizations, Clang does not work like GCC as it will not accept these things. One should really push -Os when compiling the file here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants