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: Lars Magne Ingebrigtsen
Subject: Re: Compiling Elisp to a native code with a GCC plugin
Date: Tue, 14 Sep 2010 22:17:42 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Wojciech Meyer <address@hidden> writes:

> Well Elisp nature is dynamic, plus dynamic scoping makes it hard to
> compile, but somewhat C Lispy code *can* work faster.

Sure.  Compiling to native code will probably yield some benefits, but I
think we tend to overestimate the benefits.

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.

Now, the same code in native C would of course be a lot faster, because
you'd use other data types, and you wouldn't do the code by straight
list manipulation at all.  Possibly.

-- 
(domestic pets only, the antidote for overdose, milk.)
  address@hidden * Lars Magne Ingebrigtsen




reply via email to

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