Skip to content
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

Compiler optimization flag: -O2 #698

Merged
merged 1 commit into from
Jul 15, 2024
Merged

Conversation

stradicat
Copy link
Contributor

@stradicat stradicat commented Jul 5, 2024

Added -O2 to CFLAGS for some optimizations on the C side.
I've tested in macOS, and used it for a long time in Linux and BSD, both on amd64 and i386 architectures, to improve responsiveness.

@stradicat
Copy link
Contributor Author

stradicat commented Jul 9, 2024

I get a test error specifically with emacs-plus@29 and --with-native-comp enabled:

Error: Failed changing dylib ID of /usr/local/Cellar/emacs-plus@29/29.4/Emacs.app/Contents/native-lisp/29.4-8d609dc9/preloaded/oclosure-b279097d-98bf8ff8.eln

All other versions --with-native-comp passed the tests.

Could it be a pipeline issue, or something else?

@ilyaw39
Copy link
Contributor

ilyaw39 commented Jul 10, 2024

I get a test error specifically with emacs-plus@29 and --with-native-comp enabled:

Error: Failed changing dylib ID of /usr/local/Cellar/emacs-plus@29/29.4/Emacs.app/Contents/native-lisp/29.4-8d609dc9/preloaded/oclosure-b279097d-98bf8ff8.eln

All other versions --with-native-comp passed the tests.

Could it be a pipeline issue, or something else?

I also got this strange error while testing on CI. But this seems does not affect installations locally though as seen in #691. Possible solutions may include using gln in coreutils and using newer versions of clang SDK that llvm provides. This CI-related error can be ignored anyway.


Besides that, may I take a look at your M-x emacs-build-description? Mine is

...

--with-ns --disable-ns-self-contained 'CFLAGS=-Os -w -pipe
 -mmacosx-version-min=15 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk
 -O2 -march=native -DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT

...

After a similar modification on the .rb file like yours. Note -Os is added to CFLAGS by default. This probably is done by Makefile that Emacs provides and overrides the -O2 option.

@stradicat
Copy link
Contributor Author

I get a test error specifically with emacs-plus@29 and --with-native-comp enabled:
Error: Failed changing dylib ID of /usr/local/Cellar/emacs-plus@29/29.4/Emacs.app/Contents/native-lisp/29.4-8d609dc9/preloaded/oclosure-b279097d-98bf8ff8.eln
All other versions --with-native-comp passed the tests.
Could it be a pipeline issue, or something else?

I also got this strange error while testing on CI. But this seems does not affect installations locally though as seen in #691. Possible solutions may include using gln in coreutils and using newer versions of clang SDK that llvm provides. This CI-related error can be ignored anyway.

Besides that, may I take a look at your M-x emacs-build-description? Mine is

...

--with-ns --disable-ns-self-contained 'CFLAGS=-Os -w -pipe
 -mmacosx-version-min=15 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk
 -O2 -march=native -DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT

...

After a similar modification on the .rb file like yours. Note -Os is added to CFLAGS by default. This probably is done by Makefile that Emacs provides and overrides the -O2 option.

The modified formula in my PR builds locally without problems, so the issue is on the GH pipeline side.

My Emacs M-x emacs-build-description shows:
--with-ns --disable-ns-self-contained 'CFLAGS=-Os -w -pipe -march=westmere -mmacosx-version-min=13 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -O2 -DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT'

(I'm on Ventura)

-O2 is the only CFLAGS modifier that doesn't crash the build, as opposed to the likes of -ftree-parallelize-loops=n and so on.

Copy link
Owner

@d12frosted d12frosted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks nice, thanks!
and yeah, ignore the with-native-comp on Emacs 29

@d12frosted d12frosted merged commit 746d178 into d12frosted:master Jul 15, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants