Does Lua need a JIT?

classic Classic list List threaded Threaded
31 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Does Lua need a JIT?

Dibyendu Majumdar
Hi,

Related to my post about why I have not used the JIT technology in
Ravi for my project (yet), is the question: do we need a JIT for Lua
at all?

I have no data points to tell me under what conditions a JIT makes
sense, apart from artificial benchmarks. The most obvious use case is
games programming I guess where the highest performance is needed, but
I am not a games programmer and do not know whether interpreted Lua is
good enough in this case.

In my opinion, having worked on Ravi and in my usage of it, Lua is not
a general purpose language that you would use to build a large scale
application. This is not because of any deficiency in Lua, it is more
that large scale development is better done in statically typed
languages like Java, C#, Go, Swift etc. The cost of developing complex
applications in a dynamic language is just too high. I know that many
folks on this list will probably disagree with this view, but leaving
aside your love for Lua and your wish to use Lua everywhere, would you
still use Lua as a general purpose application development platform?

I find that Lua is best suited in the context it was designed for - as
a light weight embedded scripting language that allows a system to
provide extensibility. Or as a scripting language for small standalone
tasks. And in these scenarios JIT technology is not always needed I
feel.

I feel that some folks use LuaJIT more as a substitute for C - i.e.
they would have coded in C but that is too hard to do, whereas LuaJIt
gives you almost similar capabilities in a much easier to use package,
so they use LuaJIT as if it is C. What do you guys think?

Apologies if this post is a more about philosophical questions related
to using Lua. I am just sharing some thoughts I have had for a while.

Regards
Dibyendu

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Etiene Dalcol
Having worked a lot with web development, where dynamic languages 
are heavily used to build large applications, I can't see why Lua could
not be star in that field as well along with python or ruby, for example.

 

2017-02-21 21:12 GMT+00:00 Dibyendu Majumdar <[hidden email]>:
Hi,

Related to my post about why I have not used the JIT technology in
Ravi for my project (yet), is the question: do we need a JIT for Lua
at all?

I have no data points to tell me under what conditions a JIT makes
sense, apart from artificial benchmarks. The most obvious use case is
games programming I guess where the highest performance is needed, but
I am not a games programmer and do not know whether interpreted Lua is
good enough in this case.

In my opinion, having worked on Ravi and in my usage of it, Lua is not
a general purpose language that you would use to build a large scale
application. This is not because of any deficiency in Lua, it is more
that large scale development is better done in statically typed
languages like Java, C#, Go, Swift etc. The cost of developing complex
applications in a dynamic language is just too high. I know that many
folks on this list will probably disagree with this view, but leaving
aside your love for Lua and your wish to use Lua everywhere, would you
still use Lua as a general purpose application development platform?

I find that Lua is best suited in the context it was designed for - as
a light weight embedded scripting language that allows a system to
provide extensibility. Or as a scripting language for small standalone
tasks. And in these scenarios JIT technology is not always needed I
feel.

I feel that some folks use LuaJIT more as a substitute for C - i.e.
they would have coded in C but that is too hard to do, whereas LuaJIt
gives you almost similar capabilities in a much easier to use package,
so they use LuaJIT as if it is C. What do you guys think?

Apologies if this post is a more about philosophical questions related
to using Lua. I am just sharing some thoughts I have had for a while.

Regards
Dibyendu




--
Etiene Dalcol

Software Engineer @ Red Badger 
Lua Space http://lua.space
LuaConf http://luaconf.com

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Dibyendu Majumdar
On 21 February 2017 at 21:16, Etiene Dalcol <[hidden email]> wrote:
> Having worked a lot with web development, where dynamic languages
> are heavily used to build large applications, I can't see why Lua could
> not be star in that field as well along with python or ruby, for example.
>

Sure, but is a JIT needed for this? Neither Python or Ruby have JIT
technology and Ruby is certainly successful in the web development
field.

Regards
Dibyendu

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Chris Jones
In reply to this post by Dibyendu Majumdar
Hey

We've had rumblings from some Hammerspoon users with super complex configurations, that they feel like they are running into Lua performance problems. We looked at migrating to LuaJIT, but it seems to be more work than is reasonable (plus I feel very uncertain about the project's future).

So, I don't have any actual data to offer, just anecdotes from people who would like Lua to be faster :)

Cheers,
Chris

On 21 February 2017 at 16:12, Dibyendu Majumdar <[hidden email]> wrote:
Hi,

Related to my post about why I have not used the JIT technology in
Ravi for my project (yet), is the question: do we need a JIT for Lua
at all?

I have no data points to tell me under what conditions a JIT makes
sense, apart from artificial benchmarks. The most obvious use case is
games programming I guess where the highest performance is needed, but
I am not a games programmer and do not know whether interpreted Lua is
good enough in this case.

In my opinion, having worked on Ravi and in my usage of it, Lua is not
a general purpose language that you would use to build a large scale
application. This is not because of any deficiency in Lua, it is more
that large scale development is better done in statically typed
languages like Java, C#, Go, Swift etc. The cost of developing complex
applications in a dynamic language is just too high. I know that many
folks on this list will probably disagree with this view, but leaving
aside your love for Lua and your wish to use Lua everywhere, would you
still use Lua as a general purpose application development platform?

I find that Lua is best suited in the context it was designed for - as
a light weight embedded scripting language that allows a system to
provide extensibility. Or as a scripting language for small standalone
tasks. And in these scenarios JIT technology is not always needed I
feel.

I feel that some folks use LuaJIT more as a substitute for C - i.e.
they would have coded in C but that is too hard to do, whereas LuaJIt
gives you almost similar capabilities in a much easier to use package,
so they use LuaJIT as if it is C. What do you guys think?

Apologies if this post is a more about philosophical questions related
to using Lua. I am just sharing some thoughts I have had for a while.

Regards
Dibyendu




--
Cheers,

Chris
Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Etiene Dalcol
In reply to this post by Dibyendu Majumdar
Please note PHP is also successful in web development. And NodeJS is v8 
which is JIT. So, to sum up, none of that really means anything. I was mostly 
only countering your argument that Lua should stay and be niche / scripting 
small stuff. That part is something I strongly disagree. People will look for tools
they feel comfortable with when no criteria is critical, and they will look for 
performance when that is critical for their application. 
  

2017-02-21 21:19 GMT+00:00 Dibyendu Majumdar <[hidden email]>:
On 21 February 2017 at 21:16, Etiene Dalcol <[hidden email]> wrote:
> Having worked a lot with web development, where dynamic languages
> are heavily used to build large applications, I can't see why Lua could
> not be star in that field as well along with python or ruby, for example.
>

Sure, but is a JIT needed for this? Neither Python or Ruby have JIT
technology and Ruby is certainly successful in the web development
field.

Regards
Dibyendu




--
Etiene Dalcol

Software Engineer @ Red Badger 
Lua Space http://lua.space
LuaConf http://luaconf.com

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Sean Conner
In reply to this post by Dibyendu Majumdar
It was thus said that the Great Dibyendu Majumdar once stated:

> Hi,
>
> Related to my post about why I have not used the JIT technology in
> Ravi for my project (yet), is the question: do we need a JIT for Lua
> at all?
>
> I have no data points to tell me under what conditions a JIT makes
> sense, apart from artificial benchmarks. The most obvious use case is
> games programming I guess where the highest performance is needed, but
> I am not a games programmer and do not know whether interpreted Lua is
> good enough in this case.

  I see LuaJIT useful in cases of heavy mathematics, who's speed can rival
that of C (I have some Lua code to generate a Mandelbrot set---running under
LuaJIT it's easily the same speed as a similar program in C) since LuaJIT
can optimize the heavy loops to take advantage of runtime information
(certain values never change in the loops so we can do constant propagation,
etc. etc.).

> In my opinion, having worked on Ravi and in my usage of it, Lua is not
> a general purpose language that you would use to build a large scale
> application. This is not because of any deficiency in Lua, it is more
> that large scale development is better done in statically typed
> languages like Java, C#, Go, Swift etc. The cost of developing complex
> applications in a dynamic language is just too high. I know that many
> folks on this list will probably disagree with this view, but leaving
> aside your love for Lua and your wish to use Lua everywhere, would you
> still use Lua as a general purpose application development platform?

  At work, we use Lua to parse SIP messages (using LPeg), and based on the
information given, formulate a request to a backend server to do the
"business logic" [1], receive the response from said backend server, and
reply with a new SIP message containing the information from the backend.
And this is major---it's part of the Monopolistic Phone Company's call flow
(that is, real phone calls).  

  Granted, it's not a large application (6300 lines of Lua, excluding third
party code and modules written in C, which itself if a few thousand lines of
code) but it's still an application making our company money.  Running PUC
Lua [2].

  -spc

[1] Caller Name ID---that is, for a given phone number, return an actual
        name associated with the account.

[2] Even though it's all Lua 5.1, we can't use LuaJIT because the code
        runs on the SPARC architecture [3], which LuaJIT does not support.

[3] A legal requirement for the hardware to be NEBS compliant, and Sun
        SPARC machines match that requirement.  If we could get non-SPARC
        machines that were NEBS compliant, we would in a heartbeat.


Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Rain Gloom
I only use Lua for hobby stuff so take my opinion with a grain of salt. I think one major difference between Lua and Python/Ruby is that those had already been established high level programming languages when they started doing serious web development and their standard library probably helped that. Maybe if Lua had a model like Rust's optional std, it'd be better suited for large scale high level development. It's not really a performance problem imo, but an ecosystem problem.

Also, this is just my harsh view, but Luarocks is... not very good. I use Pacman daily and Luarocks lacks many features that Pacman and other package managers in the Linux world consider basic. (eg.: how would you make Luarocks consider LulPeg and Lpeg the same?)

On Tue, Feb 21, 2017 at 10:47 PM, Sean Conner <[hidden email]> wrote:
It was thus said that the Great Dibyendu Majumdar once stated:
> Hi,
>
> Related to my post about why I have not used the JIT technology in
> Ravi for my project (yet), is the question: do we need a JIT for Lua
> at all?
>
> I have no data points to tell me under what conditions a JIT makes
> sense, apart from artificial benchmarks. The most obvious use case is
> games programming I guess where the highest performance is needed, but
> I am not a games programmer and do not know whether interpreted Lua is
> good enough in this case.

  I see LuaJIT useful in cases of heavy mathematics, who's speed can rival
that of C (I have some Lua code to generate a Mandelbrot set---running under
LuaJIT it's easily the same speed as a similar program in C) since LuaJIT
can optimize the heavy loops to take advantage of runtime information
(certain values never change in the loops so we can do constant propagation,
etc. etc.).

> In my opinion, having worked on Ravi and in my usage of it, Lua is not
> a general purpose language that you would use to build a large scale
> application. This is not because of any deficiency in Lua, it is more
> that large scale development is better done in statically typed
> languages like Java, C#, Go, Swift etc. The cost of developing complex
> applications in a dynamic language is just too high. I know that many
> folks on this list will probably disagree with this view, but leaving
> aside your love for Lua and your wish to use Lua everywhere, would you
> still use Lua as a general purpose application development platform?

  At work, we use Lua to parse SIP messages (using LPeg), and based on the
information given, formulate a request to a backend server to do the
"business logic" [1], receive the response from said backend server, and
reply with a new SIP message containing the information from the backend.
And this is major---it's part of the Monopolistic Phone Company's call flow
(that is, real phone calls).

  Granted, it's not a large application (6300 lines of Lua, excluding third
party code and modules written in C, which itself if a few thousand lines of
code) but it's still an application making our company money.  Running PUC
Lua [2].

  -spc

[1]     Caller Name ID---that is, for a given phone number, return an actual
        name associated with the account.

[2]     Even though it's all Lua 5.1, we can't use LuaJIT because the code
        runs on the SPARC architecture [3], which LuaJIT does not support.

[3]     A legal requirement for the hardware to be NEBS compliant, and Sun
        SPARC machines match that requirement.  If we could get non-SPARC
        machines that were NEBS compliant, we would in a heartbeat.



Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Dibyendu Majumdar
In reply to this post by Etiene Dalcol
On 21 February 2017 at 21:45, Etiene Dalcol <[hidden email]> wrote:
> I was mostly
> only countering your argument that Lua should stay and be niche / scripting
> small stuff.

Perhaps I used the wrong words there. I am using Ravi/Lua as a
scripting language - where the script is small but the task done is
not necessarily small. That is, the script is used to invoke large
operations. I don't know the right term to use here but maybe I am
using Lua as a 'glue' language to pull together operations. This is
relatively easy to do in Lua as it is easier to interface with C/C++
in Lua than in other scripting languages.

Front-end development is perhaps a domain where dynamic / scripting
languages are useful because the front-end often is the most volatile
part of the application - one that you want to change at quick notice,
and change often.

The rise of NodeJS is interesting - and has led to the rise of
Typescript to allow Javascript applications to scale. I think for Lua
too something like TypedLua if taken to the level of Typescript may
prove helpful in building large scale applications.

I think the question in my mind was about the need for JIT. For a
server based application replacing Java or C# at the backend, JIT may
be useful.

Regards
Dibyendu

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Coda Highland
On Tue, Feb 21, 2017 at 2:17 PM, Dibyendu Majumdar
<[hidden email]> wrote:

> On 21 February 2017 at 21:45, Etiene Dalcol <[hidden email]> wrote:
>> I was mostly
>> only countering your argument that Lua should stay and be niche / scripting
>> small stuff.
>
> Perhaps I used the wrong words there. I am using Ravi/Lua as a
> scripting language - where the script is small but the task done is
> not necessarily small. That is, the script is used to invoke large
> operations. I don't know the right term to use here but maybe I am
> using Lua as a 'glue' language to pull together operations. This is
> relatively easy to do in Lua as it is easier to interface with C/C++
> in Lua than in other scripting languages.
>
> Front-end development is perhaps a domain where dynamic / scripting
> languages are useful because the front-end often is the most volatile
> part of the application - one that you want to change at quick notice,
> and change often.
>
> The rise of NodeJS is interesting - and has led to the rise of
> Typescript to allow Javascript applications to scale. I think for Lua
> too something like TypedLua if taken to the level of Typescript may
> prove helpful in building large scale applications.
>
> I think the question in my mind was about the need for JIT. For a
> server based application replacing Java or C# at the backend, JIT may
> be useful.
>
> Regards
> Dibyendu

IIRC Snabb uses LuaJIT to handle network packet filtering, so that's a
project with some pretty stringent performance requirements that a
non-compiled language would probably have difficulty meeting.

Game actors theoretically benefit from JIT as they're polled quite
frequently (60fps, obviously) and most of the time will have
predictable hot spots. I say "theoretically" because it would take a
lot of concurrent actors to make a difference between JIT and non-JIT
on modern PC / home console hardware (assuming an efficient
interpreter), but it would make a more significant impact on portable
consoles or in games that run zillions of concurrent actors. I would
definitely want a JIT if I were implementing any sort of real-time
large-scale simulation!

/s/ Adam

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

云风 Cloud Wu
In reply to this post by Dibyendu Majumdar
Dibyendu Majumdar <[hidden email]>于2017年2月22日周三 上午5:12写道:
I am not a games programmer and do not know whether interpreted Lua is
good enough in this case.

I have been a game programmer for 20 years, and use lua since 4.0 . I think lua is good enough for game project because it's easy to embed to game engine. We need a flexible dynamic language for  gameplay  and GUI , and the performance only exists in game engine, which is written by C or C++.   I remember that I have tried to embed lua, python, javascript to my game engine for my first MMORPG project in 2001. lua is the best choice, because its less memory overhead, and we can easily manipulate the memory usage (We should run the game client in 64M Ram).
 
In my opinion, having worked on Ravi and in my usage of it, Lua is not
a general purpose language that you would use to build a large scale
application. This is not because of any deficiency in Lua, it is more
that large scale development is better done in statically typed
languages like Java, C#, Go, Swift etc. The cost of developing complex
applications in a dynamic language is just too high. I know that many
folks on this list will probably disagree with this view, but leaving
aside your love for Lua and your wish to use Lua everywhere, would you
still use Lua as a general purpose application development platform?

We now use lua both in game client and server. For our game server, there are about 10K C loc (https://github.com/cloudwu/skynet) for the framework , and more than 100K lua loc for gameplay. 

For mmo game server, Lua is still the best choice rather than go,erlang, python or nodejs because we choose the actor model for the game server framework like erlang. We can run thousands lua vm in one process that python can't (because of GIL). LuaJIT is not suitable too because of 2G memory limit. I think our framework (skynet) has better performance than nodejs even nodejs use v8 JIT, because skynet can use all the cpu cores. I have tried luaJIT for my framework , only 10%~15% performance improvements.

And coroutine in lua can be a better solution for asynchronous programming than callback model in nodejs.

I agree lua is not suitable for large program, but a large scale application can be build with many small parts. We can run many lua vm in one process like skynet does.

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Dibyendu Majumdar
On 22 February 2017 at 03:40, 云风 Cloud Wu <[hidden email]> wrote:

> Dibyendu Majumdar <[hidden email]>于2017年2月22日周三 上午5:12写道:
>>
>> I am not a games programmer and do not know whether interpreted Lua is
>> good enough in this case.
>
>
> I have been a game programmer for 20 years, and use lua since 4.0 . I think
> lua is good enough for game project because it's easy to embed to game
> engine. We need a flexible dynamic language for  gameplay  and GUI , and the
> performance only exists in game engine, which is written by C or C++.   I
> remember that I have tried to embed lua, python, javascript to my game
> engine for my first MMORPG project in 2001. lua is the best choice, because
> its less memory overhead, and we can easily manipulate the memory usage (We
> should run the game client in 64M Ram).
>

Thanks for the insight!

>>
>> In my opinion, having worked on Ravi and in my usage of it, Lua is not
>> a general purpose language that you would use to build a large scale
>> application. This is not because of any deficiency in Lua, it is more
>> that large scale development is better done in statically typed
>> languages like Java, C#, Go, Swift etc. The cost of developing complex
>> applications in a dynamic language is just too high. I know that many
>> folks on this list will probably disagree with this view, but leaving
>> aside your love for Lua and your wish to use Lua everywhere, would you
>> still use Lua as a general purpose application development platform?
>
>
> We now use lua both in game client and server. For our game server, there
> are about 10K C loc (https://github.com/cloudwu/skynet) for the framework ,
> and more than 100K lua loc for gameplay.
>
> For mmo game server, Lua is still the best choice rather than go,erlang,
> python or nodejs because we choose the actor model for the game server
> framework like erlang. We can run thousands lua vm in one process that
> python can't (because of GIL). LuaJIT is not suitable too because of 2G
> memory limit. I think our framework (skynet) has better performance than
> nodejs even nodejs use v8 JIT, because skynet can use all the cpu cores. I
> have tried luaJIT for my framework , only 10%~15% performance improvements.
>
> And coroutine in lua can be a better solution for asynchronous programming
> than callback model in nodejs.

Looks like Go might be an option for you as it is designed for this use case?


Regards
Dibyendu

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

云风 Cloud Wu


Dibyendu Majumdar <[hidden email]>于2017年2月22日周三 下午7:26写道:
>> aside your love for Lua and your wish to use Lua everywhere, would you
>> still use Lua as a general purpose application development platform?
>
>
> We now use lua both in game client and server. For our game server, there
> are about 10K C loc (https://github.com/cloudwu/skynet) for the framework ,
> and more than 100K lua loc for gameplay.
>
> For mmo game server, Lua is still the best choice rather than go,erlang,
> python or nodejs because we choose the actor model for the game server
> framework like erlang. We can run thousands lua vm in one process that
> python can't (because of GIL). LuaJIT is not suitable too because of 2G
> memory limit. I think our framework (skynet) has better performance than
> nodejs even nodejs use v8 JIT, because skynet can use all the cpu cores. I
> have tried luaJIT for my framework , only 10%~15% performance improvements.
>
> And coroutine in lua can be a better solution for asynchronous programming
> than callback model in nodejs.

Looks like Go might be an option for you as it is designed for this use case?


GC may be the  primal problem for Go although now is much better than before. Our project started  in 2012, and before go 1.5 (2015), gc in go is terrible. 

Our mmo game server used over 60G memory and 32 cores (for >10k player online) , gc may stop the world for a short time with such large heap. In my opinion, for the net/web service , latency is more important than performance , especially for game service. 

In skynet (our game framework), we use ten thousands independent lua vm in one process, which one use 1M~20M memory. They can do gc circle independently, with different frequency. And we set memory limit for different modules to avoid memory leak bug (sometimes, we forgot to dereference the object not used, it can't be collect). In go, it's hardly to limit the memory for each module/goroutine.

Another problem is about hot update. We need fix bug or update new version without shutdown the process. Lua is easy to do that but it's hardly for Go.

Erlang is similar for this use case, but our colleagues don't like write  the business code in functional language. We tried to embed lua into erlang at first, but the performance is not good enough, so we rewrite the framework in C.
 
Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Rena
In reply to this post by 云风 Cloud Wu
On Feb 21, 2017 10:40 PM, "云风 Cloud Wu" <[hidden email]> wrote:
Dibyendu Majumdar <[hidden email]>于2017年2月22日周三 上午5:12写道:
I am not a games programmer and do not know whether interpreted Lua is
good enough in this case.

I have been a game programmer for 20 years, and use lua since 4.0 . I think lua is good enough for game project because it's easy to embed to game engine. We need a flexible dynamic language for  gameplay  and GUI , and the performance only exists in game engine, which is written by C or C++.   I remember that I have tried to embed lua, python, javascript to my game engine for my first MMORPG project in 2001. lua is the best choice, because its less memory overhead, and we can easily manipulate the memory usage (We should run the game client in 64M Ram).
 
Lua has even been used in some Nintendo DS games, which have only 4M of RAM. (However it had to be modified to use fixed-point math.)

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Enrico Colombini
On 22-Feb-17 14:49, Rena wrote:
> Lua has even been used in some Nintendo DS games, which have only 4M of
> RAM. (However it had to be modified to use fixed-point math.)

I can confirm :-)
(I allocated 1 MB for Lua and adventure game data and scripting)

The only problem I find in Lua is that I had too few occasions to use
it. Some well-known game engines remind me at every step how annoying it
is to design flexible logic frameworks in a static language.

--
   Enrico

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Marc Balmer
In reply to this post by Dibyendu Majumdar
Am 21.02.17 um 22:12 schrieb Dibyendu Majumdar:

> Hi,
>
> Related to my post about why I have not used the JIT technology in
> Ravi for my project (yet), is the question: do we need a JIT for Lua
> at all?
No.

>
> I have no data points to tell me under what conditions a JIT makes
> sense, apart from artificial benchmarks. The most obvious use case is
> games programming I guess where the highest performance is needed, but
> I am not a games programmer and do not know whether interpreted Lua is
> good enough in this case.
>
> In my opinion, having worked on Ravi and in my usage of it, Lua is not
> a general purpose language that you would use to build a large scale
> application. This is not because of any deficiency in Lua, it is more
> that large scale development is better done in statically typed
> languages like Java, C#, Go, Swift etc. The cost of developing complex
> applications in a dynamic language is just too high. I know that many
> folks on this list will probably disagree with this view, but leaving
> aside your love for Lua and your wish to use Lua everywhere, would you
> still use Lua as a general purpose application development platform?
>
> I find that Lua is best suited in the context it was designed for - as
> a light weight embedded scripting language that allows a system to
> provide extensibility. Or as a scripting language for small standalone
> tasks. And in these scenarios JIT technology is not always needed I
> feel.
>
> I feel that some folks use LuaJIT more as a substitute for C - i.e.
> they would have coded in C but that is too hard to do, whereas LuaJIt
> gives you almost similar capabilities in a much easier to use package,
> so they use LuaJIT as if it is C. What do you guys think?
>
> Apologies if this post is a more about philosophical questions related
> to using Lua. I am just sharing some thoughts I have had for a while.
>
I see it like you.  If you want speed, use C.


Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Nagaev Boris
In reply to this post by Dibyendu Majumdar
On Tue, Feb 21, 2017 at 9:12 PM, Dibyendu Majumdar
<[hidden email]> wrote:
> I feel that some folks use LuaJIT more as a substitute for C - i.e.
> they would have coded in C but that is too hard to do, whereas LuaJIt
> gives you almost similar capabilities in a much easier to use package,
> so they use LuaJIT as if it is C. What do you guys think?

I think, that Go is better suited as an easier substitute of C and Python.

--
Best regards,
Boris Nagaev

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Viacheslav Usov
In reply to this post by Dibyendu Majumdar
On Tue, Feb 21, 2017 at 10:12 PM, Dibyendu Majumdar <[hidden email]> wrote:

> Related to my post about why I have not used the JIT technology in Ravi for my project (yet), is the question: do we need a JIT for Lua at all?

JIT compilation is not what the users of LuaJIT want. What they want is performance [1]. Whether it is achieved via JIT or in some other way is of no interest to the majority of the LuaJIT users.

I do not see how the rest of your argument is relevant. Performance is orthogonal to suitability for large scale application development.

Cheers,
V.

[1] FFI is another thing important for some LuaJIT users. But that does not need to be considered as something inherent to JIT compilation.
Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

GrayFace-2
In reply to this post by Dibyendu Majumdar
On Ср 22.02.17 4:12, Dibyendu Majumdar wrote:

> Related to my post about why I have not used the JIT technology in
> Ravi for my project (yet), is the question: do we need a JIT for Lua
> at all?
>
> I have no data points to tell me under what conditions a JIT makes
> sense, apart from artificial benchmarks. The most obvious use case is
> games programming I guess where the highest performance is needed, but
> I am not a games programmer and do not know whether interpreted Lua is
> good enough in this case.
>
> In my opinion, having worked on Ravi and in my usage of it, Lua is not
> a general purpose language that you would use to build a large scale
> application. This is not because of any deficiency in Lua, it is more
> that large scale development is better done in statically typed
> languages like Java, C#, Go, Swift etc. The cost of developing complex
> applications in a dynamic language is just too high. I know that many
> folks on this list will probably disagree with this view, but leaving
> aside your love for Lua and your wish to use Lua everywhere, would you
> still use Lua as a general purpose application development platform?

Yes, I'm planning to write games in Lua and no, I don't agree dynamic
typing is a big deal like that. I've made a serious level editor for
Might and Magic 6-8 games (hackerish stuff :) ) in Lua and I can say
everything came together much smoother than in any of my projects in
Delphi. LuaJIT was very important for it. So, depending on the kind of
moddability a game needs I would choose from Lua and C#, but I would
certainly never want to write any game logic in C/C++.

I've made a script to statically catch unwanted global variables access,
still haven't posted it to the list BTW. Lack of static typing is
regrettable, but in practice it wasn't a problem because of this script.
Misnamed fields are still a possibility, maybe I had 1 or 2.

In my father's experience, lack of static typing isn't a big problem in
a real complex web application developed by a small team over the course
of a few years in JavaScript.

And don't forget about compilation times, which can be a real pain in
big applications sometimes.


Best regards,
Sergey "GrayFace" Rozhenko,                 mailto:[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Coda Highland
On Thu, Feb 23, 2017 at 6:41 AM, Sergey Rozhenko <[hidden email]> wrote:

> On Ср 22.02.17 4:12, Dibyendu Majumdar wrote:
>>
>> Related to my post about why I have not used the JIT technology in
>> Ravi for my project (yet), is the question: do we need a JIT for Lua
>> at all?
>>
>> I have no data points to tell me under what conditions a JIT makes
>> sense, apart from artificial benchmarks. The most obvious use case is
>> games programming I guess where the highest performance is needed, but
>> I am not a games programmer and do not know whether interpreted Lua is
>> good enough in this case.
>>
>> In my opinion, having worked on Ravi and in my usage of it, Lua is not
>> a general purpose language that you would use to build a large scale
>> application. This is not because of any deficiency in Lua, it is more
>> that large scale development is better done in statically typed
>> languages like Java, C#, Go, Swift etc. The cost of developing complex
>> applications in a dynamic language is just too high. I know that many
>> folks on this list will probably disagree with this view, but leaving
>> aside your love for Lua and your wish to use Lua everywhere, would you
>> still use Lua as a general purpose application development platform?
>
>
> Yes, I'm planning to write games in Lua and no, I don't agree dynamic typing
> is a big deal like that. I've made a serious level editor for Might and
> Magic 6-8 games (hackerish stuff :) ) in Lua and I can say everything came
> together much smoother than in any of my projects in Delphi. LuaJIT was very
> important for it. So, depending on the kind of moddability a game needs I
> would choose from Lua and C#, but I would certainly never want to write any
> game logic in C/C++.
>
> I've made a script to statically catch unwanted global variables access,
> still haven't posted it to the list BTW. Lack of static typing is
> regrettable, but in practice it wasn't a problem because of this script.
> Misnamed fields are still a possibility, maybe I had 1 or 2.
>
> In my father's experience, lack of static typing isn't a big problem in a
> real complex web application developed by a small team over the course of a
> few years in JavaScript.
>
> And don't forget about compilation times, which can be a real pain in big
> applications sometimes.
>
>
> Best regards,
> Sergey "GrayFace" Rozhenko,                 mailto:[hidden email]

I'm a pretty die-hard C++ weenie, and I'll say that it's not as bad as
it seems on the surface. Kinda boilerplate-y, yes, but I've never
found myself lamenting that I would have an easier time of it in some
other language.

/s/ Adam

Reply | Threaded
Open this post in threaded view
|

Re: Does Lua need a JIT?

Dibyendu Majumdar
On 23 February 2017 at 15:30, Coda Highland <[hidden email]> wrote:

> On Thu, Feb 23, 2017 at 6:41 AM, Sergey Rozhenko <[hidden email]> wrote:
>> I would certainly never want to write any
>> game logic in C/C++.
>>
>
> I'm a pretty die-hard C++ weenie, and I'll say that it's not as bad as
> it seems on the surface. Kinda boilerplate-y, yes, but I've never
> found myself lamenting that I would have an easier time of it in some
> other language.
>

This may be of interest:
Jonathan Blow is creating a new language called JAI for games
programming (https://www.youtube.com/playlist?list=PLmV5I2fxaiCKfxMBrNsU1kgKJXD3PkyxO).

12