emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs Lisp JIT Compiler


From: Nickolas Lloyd
Subject: Re: Emacs Lisp JIT Compiler
Date: Sun, 11 Dec 2016 12:37:19 -0500

Burton Samograd wrote:
> By showing this ida/work I’m hoping not to get it included in emacs
> proper, but to show a relatively simple way to speed things up.  I’m
> sure there are better/alternate implementations that would both be
> cleaner and give better speedups, but this was as far as this POC went
> so far.

Coincidentally, for the past few weeks I've been working on a very
similar idea, with a slightly different implementation.  Instead of
every instruction compiling down to a function call that directly mimics
the interpreter, in many places those intermediate functions are removed
and replaced by direct calls to e.g. Ffuncall, Fconcat, etc.  Instead of
adding a new instruction to replace the original bytecode, a pointer to
the function is stashed away inside of the bytecode vector.  Other than
that it looks to be largely similar.

The code is in a repo at:

    https://github.com/smindinvern/emacs.git
    
in branch `elc-jit'.  It's based off of emacs-25, and so far during my
testing enabling the JIT globally seems to be stable. There seem to be
some performance penalties with that, though, due to some functions
which are byte-compiled many times at runtime....  I was able to produce
gains of 15-20% on your ray-tracing benchmark, though, so there is a
significant speedup for individual functions.

I bring this up, for those interested, because it is fully working with
a recent version of emacs.  Maybe there are some things that could be
learned from each implementation?

I've also looked into using libgccjit, though the object model seems a
bit more complicated, with distinctions made between lvalues, rvalues,
etc.  I'll probably do some work on porting my code to libgccjit at some
point to see how the performance compares.

Thanks,
Nick






reply via email to

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