Re: Few questions about LuaJIT internals on 64 bit

  • From: Laurent Deniau <Laurent.Deniau@xxxxxxx>
  • To: "luajit@xxxxxxxxxxxxx" <luajit@xxxxxxxxxxxxx>
  • Date: Sun, 26 Mar 2017 13:55:51 +0000


On 25 Mar 2017, at 22:05, Demi Obenour <demiobenour@xxxxxxxxx> wrote:

I think that Julia might come close.  It is designed to combine dynamic 
typing with near-C numerical performance – and it delivers.  It uses a 
different approach (abstract interpretation), but I would not be surprised if 
that could be improved upon.

Julia's VM is also pleasingly compact – about 39k lines of C, 18k of C++, 5k 
in headers and 8k of Scheme (used for the parser).  That includes a full 
Scheme VM too.   So about the same as LuaJIT​.  It does delegate the actual 
compilation to LLVM, but Julia is designed to have rich type information 
available, and that is where LLVM excels.  I don't think that includes the 
type inference engine, though – I believe that is written in Julia itself 
(though I could be wrong).


LLVM technologies haven't (yet?) the performance of LuaJIT for user defined 
small fixed size data structure (missing sink opt?). For example:

LuaJIT (+complex module): run in 5 sec on my laptop

function f(z)
  return z^2 + (1+1i)*z - 1
end
local z = 0.1
for i in ipairs(1..1e9) do
  z = f(z)
end
print(z) 

Julia 0.4 or 0.5 (native complex): run in 35 sec on my laptop

function f(z)
  return z*z + (1+1im)*z - 1
end
local z = 0.1
for i=1:1000000000
  z = f(z)
end
println(z) 

Best,
Laurent.

--
Laurent Deniau                           http://cern.ch/mad
Accelerators Beam Physics        mad@xxxxxxx
CERN, CH-1211 Geneva 23       Tel: +41 (0) 22 767 4647

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Other related posts: