[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: Mon, 19 Jan 2015 20:30:16 +0000
On 19 January 2015 at 00:08, Richard Hundt <richardhundt@gmail.com> wrote:
> I think the performance gains in the OP relate more to using static
> type annotations to generate specialized instructions which operate
> more efficiently on floating point numbers and integers, thereby
> reducing runtime coercion (at the C level, converting doubles to ints
> and back has a cost). That's as far as I can tell from a cursory
> glance at the code. I might have missed something.
My objective is certainly above.
I have thought about this for sometime - I currently use both Lua and
Luajit and ensure my code is portable across both. So the question is
given Luajit why bother.
My reasons are as follows - others may not not have similar reasons.
First, while Luajit is great and Mike is a genius the issue is that I
cannot understand, modify or support Luajit. So for a long term
investment that is a risk I cannot take. Whereas Lua is written in C
and I can understand how it works.
Second question is whether the gain in performance matters. In my case
- I intend to use Lua as an embedded language - i.e. it will provide
users ability to extend/customize etc. For the kind of applications
(it is not game programming) I have in mind the performance matters.
But this has be weighed against complexity. The great strength of Lua
is that its design is near perfect for this use case - it is a very
easy to learn and use to use language. So it is extremely important to
retain this and not complicate the language. On the other hand - when
a user gets advanced - and wants to get that bit of extra performance
- I think she will appreciate the ability to do so.
Finally is there a real gain in performance. I will test and report as
things progress. I _believe_ I can get better performance by
specializing instructions for numeric / array access. And having these
specialized instructions means that I can easily implement JIT
compilation for targeted use cases. So imagine operations involving
arrays of doubles / and numeric computation - JITed. I fully expect
that performance will be better.
Regards
Dibyendu