* bug#65988: 30.0.50; Emacs and -O3 compiler optimization
@ 2023-09-15 9:22 Arash Esbati
2023-09-15 11:29 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Arash Esbati @ 2023-09-15 9:22 UTC (permalink / raw)
To: 65988
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#65988: 30.0.50; Emacs and -O3 compiler optimization
2023-09-15 9:22 bug#65988: 30.0.50; Emacs and -O3 compiler optimization Arash Esbati
@ 2023-09-15 11:29 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-09-15 11:29 UTC (permalink / raw)
To: Arash Esbati; +Cc: 65988-done
> From: Arash Esbati <arash@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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-15 11:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-15 9:22 bug#65988: 30.0.50; Emacs and -O3 compiler optimization Arash Esbati
2023-09-15 11:29 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.