emacs-devel
[Top][All Lists]
Advanced

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

Re: byte-opt.el addition - optimize list of compile-time constants


From: Zack Weinberg
Subject: Re: byte-opt.el addition - optimize list of compile-time constants
Date: Wed, 08 Dec 2004 20:55:34 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> which is what (function ...) is for, right?  I am quite confused by
>> what the manual says about function vs. bare lambda expressions.
>
> No.  `function' is s special form, like `quote' and `while'.  But we're
> talking about sub-elements inside a quoted expression, i.e. random data
> which we have no clue whether it'll ever be used as code or not.  In such
> a context, neither `quote', nor `while' have any special meaning:
> they're only symbols.

See the other thread of the discussion.

> By the way: getting back to your original example:
>
> (when (require 'mmm-auto nil t)
>   (mmm-add-classes
>    '((md-embedded-c
>       :submode c-mode
>       :front "^{"
>       :back "^}"
>       :include-front t
>       :include-back t
>       ;; If the 'back' } is on a line by itself, include the carriage
>       ;; return too; this makes the submode background highlight look
>       ;; less strange.
>       :back-offset #'(lambda () (when (eq (following-char) ?\n)
>                                   (forward-char 1)))
>       )))
>
> How often is this code executed?  It doesn't smell like code you're using
> inside a loop, so efficiency is really completely irrelevant: the extra
> byte-codes and consing you get with backquotes is really a total non-issue.

The outer code is executed only once when the library is loaded.  The
embedded lambda *is* executed in a loop, which is why I care about it
getting compiled.  As I said in the original message, it is easy to
come up with cases where the extra byte-codes and consing from
backquotes *are* performance-relevant, but given how badly it breaks
things to enable that optimization, I'm prepared to drop that (unless
someone wants to help me debug weird byte-compiler crashes).

zw




reply via email to

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