[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: byte compiling defcustom
From: |
Dan Nicolaescu |
Subject: |
Re: byte compiling defcustom |
Date: |
Fri, 16 Nov 2007 21:40:06 -0800 |
Stefan Monnier <address@hidden> writes:
> > (defvar foo (if (featurep 'xemacs) 'bar 'baz) "doc")
> > (defcustom foo1 (if (featurep 'xemacs) 'bar 'baz) "doc")
>
>
> > Are compiled to:
>
> > (defvar foo 'baz (#$ . 543))
> > (custom-declare-variable 'foo1 '(if (featurep 'xemacs) 'bar 'baz)
'(#$ . 581))
>
> > The initial value expression for defcustom is saved and gets
> > recalculated later in some cases. So it cannot in general be
> > optimized.
>
> He probably meant "compiled" as much as "optimized".
> The same holds of keyword arguments to custom-declare-variable, by the way.
>
> > This particular simplification could be done even in defcustom, since
> > (featurep 'xemacs) is effectively a constant. But why bother
> > to implement that optimization? It works fine as it is now.
>
> The patch below implements the desired feature: it byte-compiles the
> default-value-expression (first part of the hunk) as well as any
> keyword arguments (second part of the hunk). Notice that the second
> part actually simplifies the code.
FWIW the size of a tar file containing all the elc files in emacs went
from 29511680 to 29491200 after this patch. Not the best metric, but it
shows that the patch has some impact. So I'd vote for checking it in.
- byte compiling defcustom, Dan Nicolaescu, 2007/11/14
- Re: byte compiling defcustom, Richard Stallman, 2007/11/15
- Re: byte compiling defcustom, Stefan Monnier, 2007/11/16
- Re: byte compiling defcustom, Richard Stallman, 2007/11/16
- Re: byte compiling defcustom,
Dan Nicolaescu <=
- Re: byte compiling defcustom, Luc Teirlinck, 2007/11/17
- Re: byte compiling defcustom, Dan Nicolaescu, 2007/11/17
- Re: byte compiling defcustom, Luc Teirlinck, 2007/11/17
- Re: byte compiling defcustom, Luc Teirlinck, 2007/11/17
- Re: byte compiling defcustom, Richard Stallman, 2007/11/18
- disappearing custom menu (was: Re: byte compiling defcustom), Dan Nicolaescu, 2007/11/18
- RE: disappearing custom menu (was: Re: byte compiling defcustom), Drew Adams, 2007/11/18
- Re: disappearing custom menu, Lennart Borgman (gmail), 2007/11/18
- Re: disappearing custom menu, martin rudalics, 2007/11/18
- Re: disappearing custom menu, Dan Nicolaescu, 2007/11/18