lua-users home
lua-l archive

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




On Mon, Jan 4, 2021 at 2:39 PM Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
On Mon, 4 Jan 2021 at 20:31, Russell Haley <russ.haley@gmail.com> wrote:
>
> The difference in SLOC between LLVM and MIR is hilarious: 4.13 Million LOC vs 16,000. How big is the base Ravi install?
>

Indeed. It takes seconds to build Ravi with MIR - it used to take
several minutes to build LLVM. Also resulting binaries are small.

MIR is an unbelievable project. All small JIT backends I tried before
were very bad at optimization. MIR manages to get close to 2x gcc or
clang even with its small size and thus less features. I guess it
helps that the developer of MIR is the maintainer of gcc register
allocation.


> Have you done any benchmarking between Ravi (MIR) and LuaJIT?

No, but LuaJIT will always win in the general case, as Ravi needs type
annotations for good performance. Until I can implement function
specializations with predicted types, it will be hard to beat LuaJIT.
I'm not really into competing in these regards, I was more thinking of LuaJIT as a benchmark to gauge Ravi. 
 

>
> Is it possible to just swap in Ravi where one would use Lua or are there caveats? For instance, can I run standard lua scripts and lua rocks without static types?
>

Yes but there are some caveats. I guess if you are running standard
Lua code, there is not much benefit.
I have watched the time and effort you have put into Ravi and I can say without hesitation that you are an inspiring person. Permit me (forgive me) for one moment to use "active listening" and re-write your response:

"No, but LuaJIT will always win..."
Ravi is a new piece of technology and still has many optimizations available. I have taken Ravi as far as a single human being can with the time available, and now it is up to the community to give me feedback and help invest in this great project that can benefit everyone, perhaps even Mike Pall and the LuaJIT team. MIR is a general purpose JIT so our community investment in Ravi also benefits *other languages*. The MIR author, Vladimir Makarov, is hoping to implement Ruby on top of MIR starting this year. It would be great if someone could take the time to do some benchmarking for me especially if they can use a comparison tool or website to post results against multiple languages.

"Yes but there are some caveats. I guess if you are running standard Lua code, there is not much benefit."

There are some caveats, but most code should run well. To take advantage of Ravi's features, one would need to use annotations and static typing [just a guess]. Again, if the community can test drive Ravi and give me feedback we could see where other adjustments can improve all use cases.


Regards

I won't have time to drill into your source code so I shall ask instead: 
- Did you re-use any Lua.org code? Can you guess on a percentage? (just out of curiosity)
- Were you forced to write any MIR text? What was the interface with MIR like? Or is it just standard C?