From: Paul Pogonyshev <pogonyshev@gmx.net>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: byte-code optimizations
Date: Wed, 22 Sep 2004 01:25:03 -0200 [thread overview]
Message-ID: <200409220125.03345.pogonyshev@gmx.net> (raw)
In-Reply-To: <jwvhdpr5oxo.fsf-monnier+emacs@gnu.org>
Stefan wrote:
> >> However, there is still the question of whether we should
> >> change the standard defsubst to work the way defsubst* does.
> >
> > Maybe we can even use `defmacro' for `caar' and friends. Since
> > they evaluate their lone argument only once, there must not be
> > any problems, right?
>
> Just think of (mapcar 'caar x)
Point.
> > If this (or `defsubst*') works, I'll investigate whether this
> > byte-code optimization gives any improvement after such a change.
>
> What defsubst* does is treat the argument as a kind of "lexically scoped"
> variable, but only in very limited ways. I.e. the
>
> (defsubst* caar (x) (car (car x)))
>
> will expand:
>
> (caar y) => (car (car y))
> (caar (f y)) => (let ((x (f y))) ..cl-gunk.. (car (car x)))
>
> [ The cl-gunk is stuff added by CL for CL such as a `catch' statement. ]
> If you ignore the nasty cl-gunk, I think the resulting optimization is
> similar to what we get, except it works in a few more cases.
> E.g. it'll expand
>
> (defsubst* foo (x) (symbol-value x))
>
> (foo y) => (symbol-value y)
>
> whereas our optimization won't be able to do that because it can't assume
> a "somewhat lexically scoped" semantics.
Then byte-code optimization probably has only one advantage: it works
for normal `let' bindings too. Probably not a particularly strong
advantage, though, as there must not be many so simple `let's around.
Will replacing `defsubst' definition with `defsubst*' or something
similar be visible from ``outside?'' Or, on a smaller scale, will
redefining `caar' and friends with `defsubst*' be?
Paul
next prev parent reply other threads:[~2004-09-22 3:25 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
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 [this message]
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=200409220125.03345.pogonyshev@gmx.net \
--to=pogonyshev@gmx.net \
--cc=emacs-devel@gnu.org \
--cc=rms@gnu.org \
/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).