[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"simplifications"
From: |
David Kastrup |
Subject: |
"simplifications" |
Date: |
Mon, 19 Nov 2007 11:46:47 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) |
Hi, I've seen the following:
Author: Juanma Barranquero <address@hidden> 2007-11-17 03:50:37
Committer: Juanma Barranquero <address@hidden> 2007-11-17 03:50:37
Parent: 1797ed583c1d6224dbe93db681b112a9b0278358 ((backquote): Improve
argument/docstring consistency.)
Child: 034e6631c9aab6db046645510214df80e67c29d4 (*** empty log message ***)
Branches: master, remotes/origin/master, remotes/origin/origin
Follows: merge-multi-tty-to-trunk
Precedes:
(ring-size, ring-p, ring-insert, ring-length, ring-empty-p): Use c[ad]dr.
(ring-plus1): Use `1+'.
(ring-minus1): Use `zerop'.
(ring-remove): Use c[ad]dr. Use `when'.
(ring-copy): Use c[ad]dr. Use `let', not `let*'.
(ring-ref): Use `let', not `let*'.
(ring-insert-at-beginning): Use c[ad]dr. Doc fix.
(ring-insert+extend): Use c[ad]dr. Fix typo in docstring.
(ring-member): Simplify. Doc fix.
(ring-convert-sequence-to-ring): Simplify.
Could people, before introducing such "optimizations", check the
bytecode?
(defun xxx (x) (cadr x))
generates
byte code for xxx:
args: (x)
0 varref x
1 dup
2 varbind x
3 cdr
4 car
5 unbind 1
6 return
while
(defun xxx (x) (car (cdr x)))
generates
byte code for xxx:
args: (x)
0 varref x
1 cdr
2 car
3 return
The former is _quite_ less efficient, so it is not a hot idea to use
it for data access primitives like the ring functions.
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 ...).
--
David Kastrup
- "simplifications",
David Kastrup <=
- Re: "simplifications", Juanma Barranquero, 2007/11/19
- Re: "simplifications", Stefan Monnier, 2007/11/19
- Re: "simplifications", David Kastrup, 2007/11/19
- Re: "simplifications", Juanma Barranquero, 2007/11/19
- Re: "simplifications", Stefan Monnier, 2007/11/19
- Re: "simplifications", Juanma Barranquero, 2007/11/19
- Re: "simplifications", Stefan Monnier, 2007/11/19
- Re: "simplifications", Juanma Barranquero, 2007/11/19
- Re: "simplifications", Stefan Monnier, 2007/11/19
- Re: "simplifications", David Kastrup, 2007/11/19