lua-users home
lua-l archive

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


Thanks for your replies.

It sounds like Lua is pretty easy to learn if people need to. The users probably wouldn't need to use metatables anyways. What we will have to do is write an API for them to access the data in the FPGA, set callback functions, and execute specific commands on the device.

I would also add that app developers might be assuming that the compiler does a lot of optimization, etc. PUC-Rio Lua does not do any optimization.
This was an issue in my old project.  The app team said that the Lua version of their code ran 50-500x slower than C.
I spent about 2 days getting that to 5-10x slower. I just did some basic optimizations that we all learned when we started programming (back in the dark ages).  

Did you make the optimizations in your code or in the Lua interpreter?

Why not use LuaJIT? What do people think of LuaJIT on here? Are there any cons to using LuaJIT, besides the extra space required?

Kevin


On 05/31/2018 05:50 AM, Frank Kastenholz wrote:


On May 30, 2018, at 4:45 PM, Russell Haley <russ.haley@gmail.com> wrote:



On Wed, May 30, 2018 at 10:06 AM, Kevin Wang <kevin@spikegadgets.com> wrote:
Hi everyone,

I am just getting into Lua to research it as a possible language for a grant we are working on, and was wondering if anyone could answer some questions for a beginner :)

We write software and hardware for neuroscience experiments, and are developing a new tool. Our ultimate goal in a nutshell is to have users be able to write and run scripts on their computers, but only as simulation and without low latency. The idea is that once they are satisfied with fine tuning their control script and parameters, they can then "upload" it to our device (a soft-core processor on an FPGA), in which case our backend can execute their control script with direct access to the data (going through the FPGA) for extremely low latency.

So my questions are:

1. Is Lua syntax easy to learn, especially for users that primarily code analysis scripts in Matlab or Python? (Even if it is not, if Lua turns out to meet our tech requirements, they'll just have to learn Lua anyways. Just a good thing for me to keep in mind)

On a previous project I had a similar issue.
The application developers fiercely resisted our choice of using Lua. As best I could figure out, this was all “I don’t want to learn a language that won’t help me get my next job”.

You might run in to this form of resistance.

We had two real counter arguments
1) licensing meant that Python, Java, (the app developers favorites) etc we’re not options and
2) PiL has “all you need to know about Lua” and it’s like 1/4 the size of the equivalent Python, etc, books from O’Reilly.  In other words, “Lua is easy”.

Our app developers became reasonably proficient in Lua in about a week, learning the library & environment my team was developing took another week or so

IHMO Lua is very easy to learn because the language is so small. That said, there are things about Lua that are not friendly to non-technical people (meta-tables, functional programming, upvalues) but very powerful for intermediate to advanced users.

Agreed
With the addition that these advanced things are not mandatory for core proficiency in writing basic applications


In terms of learnability and performance: Lua is used extensively in games ...

I would also add that app developers might be assuming that the compiler does a lot of optimization, etc. PUC-Rio Lua does not do any optimization.
This was an issue in my old project.  The app team said that the Lua version of their code ran 50-500x slower than C.
I spent about 2 days getting that to 5-10x slower. I just did some basic optimizations that we all learned when we started programming (back in the dark ages).  
(The app developers really didn’t like me or Lua after that ... but that’s another, nontechnical, story :-)


Where things tend to get difficult in Lua is the lack of a standard library.

Agreed

2. Is this a fair use case for Lua? I know that Lua is small enough to use on embedded devices, what about an FPGA?

Yes - ish
If Lua will be running on some standard cpu with an OS of some sort, etc, and you’d have things that look like function calls that actually send data into the FPGA to do its magic.

The project I was on did sort of the same thing. It worked well ... but you need to put time into figuring out the programming model for the lua apps and the interfaces that the model requires.  In addition you need to put a lot of time into designing the api between the Lua apps and the special functions embedded in the FPGA.

4. If not Lua, any other recommendations?

For my project we looked at Java, _javascript_, and Python. All were rehjectwd because of size/performance issues and/or the license being unacceptable

Frank Kastenholz