emacs-devel
[Top][All Lists]
Advanced

[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.





reply via email to

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