[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Optional static types for Lua - experimental derivative Ravi
- From: Dibyendu Majumdar <mobile@...>
- Date: Sun, 1 Feb 2015 00:27:41 +0000
On 29 January 2015 at 02:50, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
> I have implemented a couple of array types in Ravi - these are just
> specializations of the Lua table type.
> The two array types as of now are:
>
> local var : int[] = {}
>
> declares an integer array.
>
> local var: double[] = {}
>
> declares a double array.
>
Hi,
I wanted to give an update on where I have got to and what I have found so far.
As of now, I have implemented the ability to specify following types
for local variables:
int
int[]
double
double[]
I have implemented additional opcodes that are specialized for these types.
I terms of performance I am getting following results:
For a modified mandelbrot benchmark (links below) I am seeing about
10% improvement on Windows 64-bit. (benchmark modified to suppress
output)
For a modified fannkuchen benchmark I am seeing about 20% improvement
on Windows 64-bit (The Ravi version was modified to hardcoded
parameter 11, so the benchmark should be run with this).
My conclusion is that the interpreter performance is bounded by the
bytecode dispatch mechanism. I have not tried computed gotos as this
is orthogonal to the approach I have taken anyway.
My hope is that with the more specialized bytecodes I will be able to
get greater performance when the code is JITed. Once I have ironed out
any bugs I will look at implementing a JIT compiler. As I do not want
to have to write this for every platform I am planning to use one of
the existing JIT libraries to generate the code. (I am considering
LLVM and GNU Lightning, but will also look at libjit, nanojit, and any
others).
Assuming that I do get the performance I need once I have implemented
JIT compilation, I will get back to adding support for additional
types. The reason for this approach is to limit my investment until
the benefits are clear.
Links:
https://github.com/dibyendumajumdar/ravi/blob/master/ravi-tests/mandel.lua
https://github.com/dibyendumajumdar/ravi/blob/master/ravi-tests/mandel.ravi
https://github.com/dibyendumajumdar/ravi/blob/master/ravi-tests/fannkuchen.lua
https://github.com/dibyendumajumdar/ravi/blob/master/ravi-tests/fannkuchen.ravi
Here are the bytecode listings for Ravi:
https://github.com/dibyendumajumdar/ravi/blob/master/ravi-tests/listings/mandel.listing
https://github.com/dibyendumajumdar/ravi/blob/master/ravi-tests/listings/fannkuchen.listing
Thanks and Regards
Dibyendu