[tex-live] Fwd: Re: Re: LuajitTeX / TeXLive 2014

Élie Roux elie.roux at telecom-bretagne.eu
Sat Mar 29 07:23:45 CET 2014

Dear All,

Robin, I've transfered your mail to Luigi Scarso, the main developer of
luajittex, here are his answers that would be interestring to put in the
FAQ (as there is currently no compilation available for luajittex

Thank you,

-------- Message original --------
Sujet: 	Re: Re: [tex-live] LuajitTeX / TeXLive 2014
Date : 	Sat, 29 Mar 2014 00:57:38 +0100
De : 	luigi scarso <luigi.scarso at gmail.com>
Pour : 	Élie Roux <elie.roux at telecom-bretagne.eu>, Hans Hagen
<pragma at wxs.nl>

On Fri, Mar 28, 2014 at 10:10 PM, Élie Roux
<elie.roux at telecom-bretagne.eu <mailto:elie.roux at telecom-bretagne.eu>>

    Transfering to you in case you don't read texlive at tug.org
    <mailto:texlive at tug.org>, mainly for
    the part on "what is luajittex?"

    Thank you!

    -------- Message original --------
    Sujet: Re: [tex-live] LuajitTeX / TeXLive 2014
    Date : Fri, 28 Mar 2014 20:44:05 +0000
    De : Robin Fairbairns <Robin.Fairbairns at cl.cam.ac.uk
    <mailto:Robin.Fairbairns at cl.cam.ac.uk>>
    Pour : =?ISO-8859-1?Q?=C9lie_Roux?= <elie.roux at telecom-bretagne.eu
    <mailto:elie.roux at telecom-bretagne.eu>>
    Copie à : texlive at tug.org <mailto:texlive at tug.org> <texlive at tug.org
    <mailto:texlive at tug.org>>

    Élie Roux <elie.roux at telecom-bretagne.eu
    <mailto:elie.roux at telecom-bretagne.eu>> wrote:

    > First, in order for LuajitTeX to work with Plain and LaTeX in TeXLive,
    > the following patch should be applied to [...]

    i have been wondering whether the uk faq should mention this stuff...
    but i've been unable to reconstruct (from info i've found on the web)
    what i might say about it.

    (jit copmpilation came into my life in the context of high performance
    process control applications.  that doesn't seem, to me, to tally with
    what a tex-alike would be doing.  indeed, i find a claim in one tex/sx
    posting that luajittex runs slower than does luatex...)

    if anyone can point me to an appropriate description, for me to work up
    into one of my trivial "what is" faq answers ... well, i'll be really

luatex = lua+tex where the tex engine is derived from  pdftex
luajittex = (luatex) - lua +luajit = luajit+tex, where the tex code is
_the same_ of luatex.

luatex uses lua5.2.3
luajit uses lua5.1 with a compatibility layer for  lua5.2
Basically luajit replaces the vm of lua with vm written in assembly, and
also offers a jit compilation to native code of lua.
We have measured an increment of 20% /  40% of performance (with the
same memory footprint) due to the vm in assembly ,
but the jit compilation is not enabled by default because it introduces
slowdown due the high numbers of lua to C calls.
Also luajit has an integrated  ffi interface for dll/so -- i.e it can
loads dll /so without an intermediate C layer ---
so that luajit looks like a (incomplete)  C compiler at runtime --- and
again  this also is not used currently in context.
I think that there are two deep differences: lua has a (very imho)
powerful C api and it's easy to interface with C libraries,
while luajit gives its best if one uses the ffi, and in this case the
jit is ok.
This means that to achive the 10x speedups one must start from the
beginning with luajit and code in a mix of lua and C-ish
with all the drawbacks of C (ie no garbage collection, no protection
from seg fault...).
We have also found some cases where luajit  runs slower than lua51 due a
different hashing algorithm
but we have made a patch that solves  this problem (ie the performance
are now the same of lua5.1).
Lua 5.2 also had similar problem but the patch was less intrusive.

    > Also, I'm wondering if LuajitTeX will be included in TeXLive 2014 now
    > that it's fully part of LuaTeX repository? If so, will it be
    > as an engine,

    hah!  compiling on every tex live platform ... isn't starting such a
    project in april a bit optimistic?

luajittex was released in December of 2012, and it was merged with luatex in
2014-02-10 and then was accepted for the TL.
The release 0.79 is the first _from_ TL with   luatex and luajittex
Prof. A. Kakuto  has always  released win32/win64 binaries from the very
binaries for linux 32/64 on intel are  not a problem, as also the Mac
Osx (I think that these cover the 99%)

    > with the corresponding commands and formats (dviluajitlatex, etc.)?

    aaarrrgh.  another excuse to obfuscate command names.  we have enough
    users confused by the ideas of different tex-alike engines, as things

    stand ...

hm. Basically nowadays there are the tex (used & maintained by D.
Knuth), the etex, the pdftex and the luatex engines.
They have different primitives, so these engines are different
implementation of TeX (the tex engine is the father of all).
>From this point of view, luajittex is not a different engine from luatex.
The differences are on the Lua side: the lua grammar  is _slightly_
different (but one can argue that 1 on one milliion is a big difference
for computer languages )
the memory limit of the intepreters are _very_  different (1GByte luajit
vs 4GByte of lua), the bytecode is _completely_ different (ie one cannot
exchange the lua file bytecompiled).
ConTeXt  MKIV has a single codebase (lua+tex ) and one can choose the
engine luatex or luajitex at runtime; for the pdftex engine there is a
different codebase (only tex) marked as MKII
(the reason why context mkiv with luajittex is faster than context mkiv
with luatex is that more than 50% of codebase of context is in lua) .
I argue that something similar it's possible also in LaTeX --- but I'm
not in the position to suggest how to do this.

     will it never end?

Who knows ?


More information about the tex-live mailing list