unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: byte-code optimizations
Date: Tue, 21 Sep 2004 14:31:28 -0400	[thread overview]
Message-ID: <E1C9pQG-0005KW-T2@fencepost.gnu.org> (raw)
In-Reply-To: <200409191412.50820.pogonyshev@gmx.net> (message from Paul Pogonyshev on Sun, 19 Sep 2004 14:15:11 -0200)

    However, we (actually Stefan) need to decide whether we want to try
    optimizing unbinds without visible bindings.  I.e. I'm optimizing

	    varbind-X ... unbind-N --> discard ... unbind-(N-1)

    while Stefan suggests a more general

	    ... unbind-1 --> unbind-1 ...

    which is then followuped by other (existing) optimizations.

The way to decide this is to look at what the results would be in
various cases.  Simply doing the unbind-1 earlier is not a significant
improvement; it does not make the code smaller or faster.  As far as I
can see, the only way it achieves a benefit is if it leads to
eliminating the unbind-1.  That would only happen if Stefan's
optimization moves the unbind-1 back to right after a varbind, right?
If so is optimization is indirectly equivalent to yours.

I can see one other case where Stefan's optimization might make a
difference.  If we install your tail-jumping optimization, Stefan's
optimization might produce more opportunities to do tail-jumping, or
it might ruin some opportunities to do tail-jumping.  But I think
that effect will be too small to matter anyway.

Unless I have missed some point here, I think your version of the
optimization is the better of the two (all else being equal), because
it gets directly to the desired result instead of requiring it to be
done in two steps.

Some comments on details of your code:

    +(put 't 'binding-is-magic t)
    +(put 'nil 'binding-is-magic t)

That is unnecessary; you can't bind nil or t,

    +(put 'debug-on-next-call 'binding-is-magic t)

That is unnecessary, since a function call would never
be safe to do this optimization over,

    +(defconst byte-compile-side-effect-free-dynamically-safe-ops
    +  '(;; Same as `byte-compile-side-effect-free-ops' but without
    +    ;; `byte-varref', `byte-symbol-value' and certain editing
    +    ;; primitives.

Why exclude byte-symbol-value?

After you deal with those little points, I'd like your code to be
installed.  However, there is still the question of whether we should
change the standard defsubst to work the way defsubst* does.

  reply	other threads:[~2004-09-21 18:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-18 13:52 byte-code optimizations Paul Pogonyshev
2004-09-18 20:26 ` Stefan
2004-09-19 11:00   ` Richard Stallman
2004-09-19 16:15   ` Paul Pogonyshev
2004-09-21 18:31     ` Richard Stallman [this message]
2004-09-22  0:42       ` Paul Pogonyshev
2004-09-21 21:05         ` Stefan Monnier
2004-09-21 21:15           ` Miles Bader
2004-09-22  3:31             ` Paul Pogonyshev
2004-09-21 22:57               ` Miles Bader
2004-09-22  3:25           ` Paul Pogonyshev
2004-09-22 18:20         ` Richard Stallman
2004-09-23  0:33           ` Paul Pogonyshev
2004-09-18 22:55 ` Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1C9pQG-0005KW-T2@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).