help-gnu-emacs
[Top][All Lists]
Advanced

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

zerop: compiler macro vs defsubst (was: no empty (zero) string predicate


From: Nicolas Richard
Subject: zerop: compiler macro vs defsubst (was: no empty (zero) string predicate in Elisp)
Date: Mon, 27 Apr 2015 12:28:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:
> C-h f zerop RET says:
>
>    zerop is a compiled Lisp function in `subr.el'.
>    [...]
>    This function has a compiler macro `zerop--anon-cmacro'.
>    
> and if you look at this mysterious zerop--anon-cmacro, you'll see that
> it optimizes `zerop' by rewriting it to (= 0 ...), which is implemented
> more efficiently.

IIUC the efficiency is obtained by inlining the definition thus avoiding
a function call. What's the difference between using that compiler macro
and using defsubst ?

-- 
Nicolas



reply via email to

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