GNU bug report logs - #24720
Performance impact of -no-pie

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Mon, 17 Oct 2016 20:20:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

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 24720 in the body.
You can then email your comments to 24720 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Mon, 17 Oct 2016 20:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Eggert <eggert <at> cs.ucla.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 17 Oct 2016 20:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Emacs bug reports <bug-gnu-emacs <at> gnu.org>
Cc: Alex <agrambot <at> gmail.com>
Subject: Performance impact of -no-pie
Date: Mon, 17 Oct 2016 13:18:51 -0700
(The rest of this message is copied from Alex's email archived at 
<http://lists.gnu.org/archive/html/emacs-devel/2016-10/msg00451.html>.)

After being forced to add -no-pie to my CFLAGS in order to build Emacs with a recent GCC, my startup time for my whole config (with -nw) has increased from ~1 second to ~2 seconds.

The startup time for `emacs -Q -nw` went up from about 0.07s to 0.14s; again it's about twice as slow.

The -Q time doesn't worry me, but the extra second for my main configuration isn't pleasant.

Is such a performance impact expected? If so, is there a plan to regain the old speed?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Mon, 17 Oct 2016 20:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 24720 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Alex <agrambot <at> gmail.com>
Cc: 24720 <at> debbugs.gnu.org
Subject: Re: Performance impact of -no-pie
Date: Mon, 17 Oct 2016 13:26:32 -0700
> Is such a performance impact expected? If so, is there a plan to regain the old speed?

No, such a performance change is not expected.

Can you reproduce the problem with the emacs-25 or master branches, 
without manually adding -no-pie to CFLAGS? The bleeding-edge versions of 
Emacs attack the problem in a slightly different way, which might affect 
performance less.

If you still see a performance problem, can you narrow it down, e.g., by 
configuring it with --enable-profiling and seeing where the extra cycles 
are going?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Tue, 18 Oct 2016 04:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 24720 <at> debbugs.gnu.org (full text, mbox):

From: Alex <agrambot <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 24720 <at> debbugs.gnu.org
Subject: Re: Performance impact of -no-pie
Date: Mon, 17 Oct 2016 22:06:11 -0600
Paul Eggert <eggert <at> cs.ucla.edu> writes:

>> Is such a performance impact expected? If so, is there a plan to regain the
> old speed?
>
> No, such a performance change is not expected.
>
> Can you reproduce the problem with the emacs-25 or master branches, without
> manually adding -no-pie to CFLAGS? The bleeding-edge versions of Emacs attack
> the problem in a slightly different way, which might affect performance less.
>
> If you still see a performance problem, can you narrow it down, e.g., by
> configuring it with --enable-profiling and seeing where the extra cycles are
> going?

Ah, I see. It looks like the bleeding-edge versions add -no-pie to
LDFLAGS instead of CFLAGS. Doing the same thing myself both to those
versions and the 25.1 tarball (which is what I was using before) now
results in the same performance as before, within error.

Is it a bug that adding -no-pie to CFLAGS slows startup and runtime
performance by a factor of 2?

I would have expected that -no-pie would generally be faster compared to
-pie. Is that not the case?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Tue, 18 Oct 2016 05:56:02 GMT) Full text and rfc822 format available.

Message #14 received at 24720 <at> debbugs.gnu.org (full text, mbox):

From: Cesar Quiroz <cesar.quiroz <at> gmail.com>
To: agrambot <at> gmail.com
Cc: 24720 <at> debbugs.gnu.org
Subject: Re: Performance impact of -no-pie
Date: Mon, 17 Oct 2016 22:54:38 -0700
[Message part 1 (text/plain, inline)]
Another data point: Ubuntu 16.10 offers emacs 24.5 in /usr/bin/emacs.  It
is built with -no-pie. Could you check if /usr/bin/emacs also feels slow?


--César
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Tue, 18 Oct 2016 16:00:03 GMT) Full text and rfc822 format available.

Message #17 received at 24720 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Alex <agrambot <at> gmail.com>
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 24720 <at> debbugs.gnu.org
Subject: Re: bug#24720: Performance impact of -no-pie
Date: Tue, 18 Oct 2016 11:59:15 -0400
All that adding -no-pie does is restore the old default behaviour.
It therefore makes no sense for it to cause a slowdown.
I'm going to guess that when you set it via CFLAGS, you lost the -O2
that is otherwise part of the default CFLAGS. M-x report-emacs-bug
includes information that would probably have made this obvious from the
outset. Check the setting of CFLAGS in src/Makefile.





Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 18 Oct 2016 16:22:01 GMT) Full text and rfc822 format available.

Notification sent to Paul Eggert <eggert <at> cs.ucla.edu>:
bug acknowledged by developer. (Tue, 18 Oct 2016 16:22:02 GMT) Full text and rfc822 format available.

Message #22 received at 24720-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Glenn Morris <rgm <at> gnu.org>, Alex <agrambot <at> gmail.com>
Cc: 24720-done <at> debbugs.gnu.org
Subject: Re: bug#24720: Performance impact of -no-pie
Date: Tue, 18 Oct 2016 09:21:27 -0700
On 10/18/2016 08:59 AM, Glenn Morris wrote:
> I'm going to guess that when you set it via CFLAGS, you lost the -O2
> that is otherwise part of the default CFLAGS.

Yes, that sounds quite plausible. Thanks for the diagnosis. Closing the bug.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Wed, 19 Oct 2016 04:42:01 GMT) Full text and rfc822 format available.

Message #25 received at 24720 <at> debbugs.gnu.org (full text, mbox):

From: Alex <agrambot <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 24720 <at> debbugs.gnu.org
Subject: Re: bug#24720: Performance impact of -no-pie
Date: Tue, 18 Oct 2016 22:41:02 -0600
Glenn Morris <rgm <at> gnu.org> writes:

> All that adding -no-pie does is restore the old default behaviour.
> It therefore makes no sense for it to cause a slowdown.

That makes sense.

> I'm going to guess that when you set it via CFLAGS, you lost the -O2
> that is otherwise part of the default CFLAGS.

That's indeed the case. I thought that specifying it when calling
./configure would have just added to the default CFLAGS instead of
overwriting it. Sorry for the false report.

> M-x report-emacs-bug includes information that would probably have
> made this obvious from the outset. Check the setting of CFLAGS in
> src/Makefile.

No, without specifying any CFLAGS manually, report-emacs-bug doesn't
mention any configuration details. This appears to be because
system-configuration-options is empty in that case.

Only when manually specifying flags does report-emacs-bug show the
configuration option section.

I can see what the CFLAGS are in src/Makefile, thanks. Though it might
be nice if I could see these at the Elisp level even when they're the
default.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Wed, 19 Oct 2016 07:06:02 GMT) Full text and rfc822 format available.

Message #28 received at 24720 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alex <agrambot <at> gmail.com>
Cc: rgm <at> gnu.org, eggert <at> cs.ucla.edu, 24720 <at> debbugs.gnu.org
Subject: Re: bug#24720: Performance impact of -no-pie
Date: Wed, 19 Oct 2016 10:04:51 +0300
> From: Alex <agrambot <at> gmail.com>
> Date: Tue, 18 Oct 2016 22:41:02 -0600
> Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 24720 <at> debbugs.gnu.org
> 
> I can see what the CFLAGS are in src/Makefile, thanks. Though it might
> be nice if I could see these at the Elisp level even when they're the
> default.

The default switches are known, so they don't need to be spelled out
in the report.  It's the non-default ones that needs to be shown.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Wed, 19 Oct 2016 19:47:02 GMT) Full text and rfc822 format available.

Message #31 received at 24720 <at> debbugs.gnu.org (full text, mbox):

From: Alex <agrambot <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rgm <at> gnu.org, eggert <at> cs.ucla.edu, 24720 <at> debbugs.gnu.org
Subject: Re: bug#24720: Performance impact of -no-pie
Date: Wed, 19 Oct 2016 13:45:47 -0600
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Alex <agrambot <at> gmail.com>
>> Date: Tue, 18 Oct 2016 22:41:02 -0600
>> Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 24720 <at> debbugs.gnu.org
>> 
>> I can see what the CFLAGS are in src/Makefile, thanks. Though it might
>> be nice if I could see these at the Elisp level even when they're the
>> default.
>
> The default switches are known, so they don't need to be spelled out
> in the report.  It's the non-default ones that needs to be shown.

I agree that they don't need to be in the report, but just having them
in a variable (e.g. system-configuration-options) would make it easier
for users to see what the default switches are.

For example, I would have compared system-configuration-options between
the slow and fast builds and noticed that the fast build had '-O2' while
the slow one didn't, and this report wouldn't have been filed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Thu, 20 Oct 2016 07:06:02 GMT) Full text and rfc822 format available.

Message #34 received at 24720 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alex <agrambot <at> gmail.com>
Cc: rgm <at> gnu.org, eggert <at> cs.ucla.edu, 24720 <at> debbugs.gnu.org
Subject: Re: bug#24720: Performance impact of -no-pie
Date: Thu, 20 Oct 2016 10:04:35 +0300
> From: Alex <agrambot <at> gmail.com>
> Cc: rgm <at> gnu.org,  eggert <at> cs.ucla.edu,  24720 <at> debbugs.gnu.org
> Date: Wed, 19 Oct 2016 13:45:47 -0600
> 
> > The default switches are known, so they don't need to be spelled out
> > in the report.  It's the non-default ones that needs to be shown.
> 
> I agree that they don't need to be in the report, but just having them
> in a variable (e.g. system-configuration-options) would make it easier
> for users to see what the default switches are.
> 
> For example, I would have compared system-configuration-options between
> the slow and fast builds and noticed that the fast build had '-O2' while
> the slow one didn't, and this report wouldn't have been filed.

You have that information in config.log, so I'm unsure why you
couldn't find it if you looked for it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Thu, 20 Oct 2016 22:15:01 GMT) Full text and rfc822 format available.

Message #37 received at 24720 <at> debbugs.gnu.org (full text, mbox):

From: Alex <agrambot <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rgm <at> gnu.org, eggert <at> cs.ucla.edu, 24720 <at> debbugs.gnu.org
Subject: Re: bug#24720: Performance impact of -no-pie
Date: Thu, 20 Oct 2016 16:13:56 -0600
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Alex <agrambot <at> gmail.com>
>> Cc: rgm <at> gnu.org,  eggert <at> cs.ucla.edu,  24720 <at> debbugs.gnu.org
>> Date: Wed, 19 Oct 2016 13:45:47 -0600
>> 
>> > The default switches are known, so they don't need to be spelled out
>> > in the report.  It's the non-default ones that needs to be shown.
>> 
>> I agree that they don't need to be in the report, but just having them
>> in a variable (e.g. system-configuration-options) would make it easier
>> for users to see what the default switches are.
>> 
>> For example, I would have compared system-configuration-options between
>> the slow and fast builds and noticed that the fast build had '-O2' while
>> the slow one didn't, and this report wouldn't have been filed.
>
> You have that information in config.log, so I'm unsure why you
> couldn't find it if you looked for it.

Yes, in this case I could have looked in there, but that file is
overwritten with every ./configure, right? That means there's no
guarantee that what's listed there is for a given Emacs build.

I think that configuration options should be tied to, and viewable
through, Emacs regardless of the value it's set to. If report-emacs-bugs
needs to know when to hide the options, then perhaps a new variable
could be introduced for that purpose.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24720; Package emacs. (Wed, 26 Oct 2016 04:31:01 GMT) Full text and rfc822 format available.

Message #40 received at 24720 <at> debbugs.gnu.org (full text, mbox):

From: Alex <agrambot <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rgm <at> gnu.org, eggert <at> cs.ucla.edu, 24720 <at> debbugs.gnu.org
Subject: Re: bug#24720: Performance impact of -no-pie
Date: Tue, 25 Oct 2016 22:30:31 -0600
Alex <agrambot <at> gmail.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: Alex <agrambot <at> gmail.com>
>>> Cc: rgm <at> gnu.org,  eggert <at> cs.ucla.edu,  24720 <at> debbugs.gnu.org
>>> Date: Wed, 19 Oct 2016 13:45:47 -0600
>>> 
>>> > The default switches are known, so they don't need to be spelled out
>>> > in the report.  It's the non-default ones that needs to be shown.
>>> 
>>> I agree that they don't need to be in the report, but just having them
>>> in a variable (e.g. system-configuration-options) would make it easier
>>> for users to see what the default switches are.
>>> 
>>> For example, I would have compared system-configuration-options between
>>> the slow and fast builds and noticed that the fast build had '-O2' while
>>> the slow one didn't, and this report wouldn't have been filed.
>>
>> You have that information in config.log, so I'm unsure why you
>> couldn't find it if you looked for it.
>
> Yes, in this case I could have looked in there, but that file is
> overwritten with every ./configure, right? That means there's no
> guarantee that what's listed there is for a given Emacs build.
>
> I think that configuration options should be tied to, and viewable
> through, Emacs regardless of the value it's set to. If report-emacs-bugs
> needs to know when to hide the options, then perhaps a new variable
> could be introduced for that purpose.

For example, in configure.ac, if the block that calculates
emacs_config_options was moved to the bottom before

AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}",
		   [Define to the options passed to configure.])

then system-configuration-options is:

"dummy pkg-config 'CFLAGS=-g3 -O2' 'CPPFLAGS=  ' 'LDFLAGS= '"

I'm not sure what 'dummy pkg-config' is doing there, but otherwise I
think that it would be nice to have this as the default.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Nov 2016 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 155 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.