emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "simplifications"


From: Juanma Barranquero
Subject: Re: "simplifications"
Date: Mon, 19 Nov 2007 11:56:35 +0100

On Nov 19, 2007 11:46 AM, David Kastrup <address@hidden> wrote:

> Could people, before introducing such "optimizations", check the
> bytecode?

Some functions of ring.el already used c??r before my change. etc.

> The former is _quite_ less efficient, so it is not a hot idea to use
> it for data access primitives like the ring functions.

Out of idle curiosity, I'd be really interested in knowing about uses
of ring.el where that difference is going to be significant (i.e.,
we're speaking perhaps of thousands of ring function calls per
second?).

> Personally, I think that we should make the byte compiler optimize the
> unnecessary binding away.  But until that is the case, please don't
> gratuitously replace (car (cdr ...)) with (cadr ...).

I don't usually do it gratuitously, or I would've done it in a lot of
places. I stumbled upon it, and certainly having code chock-full of

 (let ((hd (car (car ...)))
        (ln (car ...))
        (vec (cdr (cdr ...))))

is not my idea of fun, or legible, or maintainable, or... you pick the
word. Not that c??r is much of an improvement; we should be able to
define accesor functions in the package

 (defsubst ring--vec (ring)
    (cdr (cdr ring)))

and have the byte-compiler optimize them away.

So, IMO, instead of bringing back the pain, let's enhance the byte-optimizer.

But of course, you can revert the change if you dislike it that much.

             Juanma




reply via email to

[Prev in Thread] Current Thread [Next in Thread]