From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: lekktu@gmail.com, 12327@debbugs.gnu.org
Subject: bug#12327: Signal-handler cleanup for Emacs
Date: Mon, 03 Sep 2012 00:20:42 +0300 [thread overview]
Message-ID: <838vcsf7f9.fsf@gnu.org> (raw)
In-Reply-To: <5043ACF7.7080100@cs.ucla.edu>
> Date: Sun, 02 Sep 2012 12:01:11 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 12327@debbugs.gnu.org, lekktu@gmail.com
>
> On 09/02/2012 10:51 AM, Eli Zaretskii wrote:
>
> > that doesn't impede code reading and understanding in any way
>
> Sure it does, because Emacs defines symbols incompatibly with their
> normal meanings. E.g., Emacs redefines 'sigblock' to be a macro
> whose type signature is incompatible with the 'sigblock'
> that is found on GNU/Linux.
If that's the problem, then fix that, by changing the type. Why do
more than is strictly needed? Gratuitous changes are BAAAD!
> > I could go with replacing 'signal' etc. with their modern Posix
> > replacements, such as 'sigaction', directly in the code.
>
> That would make the mainline code significantly less readable.
> Instead of this, for example:
>
> unblock_signal (SIGPIPE);
>
> send_process_trap would have to do something like this:
>
> sigset_t mask;
> ...
> sigemptyset (&mask);
> sigaddset (&mask, SIGPIPE);
> pthread_sigmask (SIG_UNBLOCK, &mask, NULL);
>
> which is not an improvement.
Of course, it's an improvement! That kind of code is a pattern
programmers are used to see when signals are being masked. By
contrast, when I see a call to unblock_signal, I need to look it up.
> I suspect the main reason that Emacs currently uses macros reminiscent
> but incompatible with the obsolete 4.2BSD interface, rather than the
> standard POSIX interface, is because the 4.2BSD interface was simpler.
No, it's just because the BSD interface was there first.
> Unfortunately, the 4.2BSD interface does not scale well to modern
> systems with lots of signals.
I suggested to use sigaction and friends, not go back to the old APIs.
> > I fail to see any good reasons for changes that, e.g., hide a
> > pair of calls to well-known library functions, such as 'sigemptyset'
> > and 'sigaddset', behind 'sigsetmask' (which AFAIK is a BSD-ism)
>
> There must be some confusion here.
Yeah, did I say the new code is confusing?
> > As for 0.6% reduction in the size of .text: what kind of humongous
> > .text size do you have that makes 0.6% a significant value?
>
> Every little bit helps, no?
Not every little bit can be justified by such non-trivial changes.
Changes come at a cost, which should be justified.
> But the main point of measuring text size
> is as a rough gauge of the efficiency implications. If the text
> segment had grown, that would have been a bad sign.
Not necessarily. And certainly not at fractions of a percent.
> Fewer instructions mean faster CPU performance, partly due to lower
> pressure on the instruction cache.
This all smells premature optimization to me. Text segment size has
no direct relation to pressure on the instruction cache. What matters
is the structure of the code in terms of branches and loops, and its
locality. The size alone is almost meaningless. I'm sure you know
that.
> I didn't bother to measure CPU performance earlier, since that takes
> more work, but I just now did that with an artificial benchmark that
> simply blocks and then unblocks SIGCHLD, and on my platform the
> proposed patch speeds up this benchmark by 15%.
A meaningless benchmark, IMO. You need to measure an Emacs loop that
does these block and unblock operations (if there is such a loop), and
see the effect on that. _That_ would be interesting.
next prev parent reply other threads:[~2012-09-02 21:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-01 22:38 bug#12327: Signal-handler cleanup for Emacs Paul Eggert
2012-09-02 17:51 ` Eli Zaretskii
2012-09-02 18:37 ` Eli Zaretskii
2012-09-02 19:01 ` Paul Eggert
2012-09-02 21:20 ` Eli Zaretskii [this message]
2012-09-03 8:16 ` Paul Eggert
2012-09-03 8:49 ` Andreas Schwab
2012-09-03 9:02 ` Paul Eggert
2012-09-03 9:17 ` Andreas Schwab
2012-09-04 8:12 ` Paul Eggert
2012-09-06 11:59 ` Andy Moreton
2012-09-06 14:41 ` martin rudalics
2012-09-06 16:46 ` Eli Zaretskii
2012-09-06 16:54 ` Andy Moreton
2012-09-06 17:20 ` Eli Zaretskii
2012-09-06 17:37 ` martin rudalics
2012-09-03 15:32 ` Eli Zaretskii
2012-09-07 1:35 ` Paul Eggert
2012-09-07 6:02 ` Eli Zaretskii
2012-09-07 7:26 ` Eli Zaretskii
2012-09-07 8:27 ` Eli Zaretskii
2012-09-07 8:59 ` Paul Eggert
2012-09-07 10:21 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=838vcsf7f9.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=12327@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=lekktu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.