emacs-devel
[Top][All Lists]
Advanced

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

Re: Compiling Elisp to a native code with a GCC plugin


From: Wojciech Meyer
Subject: Re: Compiling Elisp to a native code with a GCC plugin
Date: Tue, 14 Sep 2010 21:52:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50

Lars Magne Ingebrigtsen <address@hidden> writes:

> To take a random example from code I just wrote (part of
> `gnus-range-nconcat'), which works on lists and numbers and stuff, and
> is as low-level as Emacs Lisp code gets:
>
>       (when (numberp (car last))
>       (setcar last (cons (car last) (car last))))
>       (if (= (1+ (cdar last)) (caar range))
>         (progn
>           (setcdr (car last) (cdar range))
>           (setcdr last (cdr range))))
>
> Just imagine what that would be in native code, as opposed to byte code.
> In either case, it'd just be a lot of calls to Fcar, Fcons, Fsetcar and
> so on.  Would the byte-interpreter call those functions a lot slower
> than native code would?  I kinda doubt it.

Some of the functions will be in-lined, some of the data pointers will be
loaded to registers, some of the calls will be specialised against
constants, some of the expressions simplified, the flat code peep-holed
etc. So no, it is not direct translation even at the level of byte-code,
and compiler frameworks (gcc & llvm) are getting better and better at
optimising at high-level and low-level.

Wojciech



reply via email to

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