GNU bug report logs -
#65988
30.0.50; Emacs and -O3 compiler optimization
Previous Next
Reported by: Arash Esbati <arash <at> gnu.org>
Date: Fri, 15 Sep 2023 09:24:01 UTC
Severity: wishlist
Found in version 30.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65988 in the body.
You can then email your comments to 65988 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#65988
; Package
emacs
.
(Fri, 15 Sep 2023 09:24:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Arash Esbati <arash <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 15 Sep 2023 09:24:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi all,
in this message[1], Eli explained why the -O3 optimization switch isn't
recommended when building Emacs:
In a nutshell, it bloats the code (due to excessive inlining), with no
real effect on speed. The inner loops in Emacs are very large, and
thus the techniques used by -O3 to speed up code (loop unrolling etc.)
don't really work. Moreover, they could make things worse because the
larger loops might no longer fit into the L1 cache of the CPU.
The -O3 is well suited to speed up relatively simple algorithms with
tight loops. Emacs has very few of those, in the places that matter
for observable performance.
Presuming that the note above applies to GCC on all platforms, I suggest
to change/adjust the following example in INSTALL[2]:
Here's an example of a 'configure' invocation, assuming a Bourne-like
shell such as Bash, which uses these variables:
./configure \
CPPFLAGS='-I/foo/myinclude' LDFLAGS='-L/bar/mylib' \
CFLAGS='-O3' LIBS='-lfoo -lbar'
(this is all one shell command). This tells 'configure' to instruct the
preprocessor to look in the '/foo/myinclude' directory for header
files (in addition to the standard directories), instruct the linker
to look in '/bar/mylib' for libraries, pass the -O3 optimization
switch to the compiler, and link against libfoo and libbar
libraries in addition to the standard ones.
IIRC this was the place where I picked up the -O3 switch for the script
I wrote for building Emacs.
Best, Arash
Footnotes:
[1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-06/msg01274.html
[2] http://git.savannah.gnu.org/cgit/emacs.git/tree/INSTALL#n493
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 15 Sep 2023 10:50:01 GMT)
Full text and
rfc822 format available.
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Fri, 15 Sep 2023 11:31:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Arash Esbati <arash <at> gnu.org>
:
bug acknowledged by developer.
(Fri, 15 Sep 2023 11:31:02 GMT)
Full text and
rfc822 format available.
Message #12 received at 65988-done <at> debbugs.gnu.org (full text, mbox):
> From: Arash Esbati <arash <at> gnu.org>
> Date: Fri, 15 Sep 2023 11:22:36 +0200
>
> Presuming that the note above applies to GCC on all platforms, I suggest
> to change/adjust the following example in INSTALL[2]:
>
> Here's an example of a 'configure' invocation, assuming a Bourne-like
> shell such as Bash, which uses these variables:
>
> ./configure \
> CPPFLAGS='-I/foo/myinclude' LDFLAGS='-L/bar/mylib' \
> CFLAGS='-O3' LIBS='-lfoo -lbar'
>
> (this is all one shell command). This tells 'configure' to instruct the
> preprocessor to look in the '/foo/myinclude' directory for header
> files (in addition to the standard directories), instruct the linker
> to look in '/bar/mylib' for libraries, pass the -O3 optimization
> switch to the compiler, and link against libfoo and libbar
> libraries in addition to the standard ones.
>
> IIRC this was the place where I picked up the -O3 switch for the script
> I wrote for building Emacs.
You really shouldn't treat what's in INSTALL so literally: it's just
an example to illustrate how to use these switches.
I changed it not to use -O3.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 14 Oct 2023 11:24:12 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 249 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.