Precompile Lua-apps, save a lot of memory!

Lua-apps are scripts that can be edited in text-editors and when ran on transmitter they are compiled to be executable. We know that this takes some memory especially when starting the app like in powering on transmitter and loading the model.

Now Jetimodel came up with a very clever solution, let’s compile the apps before we transfer them to transmitter.

What?

In short, run the Dumper-app, select to compile everything. What the Dumper does is it takes the app.lua and compiles it to executable app.lc. Now when loading the app.lc file to transmitter the transmitter no longer needs to make the compilation and saves memory in the process.

Results

Results are remarkable in my eyes. I ran this small tool with all RC-Thoughts Jeti Tools apps currently available. I ran both the -24 and -16 versions of my apps in emulator. Here’s the results:

This is especially important and valuable in 14 and 16 where memory-usage really is an issue. Saving up to 12% in memory is very valuable. We can use this with two main ideas:

  • Save memory, plain and simple
  • Use same amount memory as before but with added functions

The latter is very interesting, for example my apps for 14/16 are in practice slimmed-down versions of -24 apps with reduced amount of functions and / or features. This allows for more functions while still getting under the 50kB memory limit.

What is of great importance is the memory-load to transmitter in startup or changing model reducing possibility to memory-related issues when we users try to use apps running on memory-limit.

I have tested the compiled files on both DS-16 and DC-24, everything works as it should.

Where?

Dumper-app is available on Jetimodels github here.

How To?

Usage is really simple. I recommend doing this in Jeti Studio DC-24 emulator and after testing move the compiled .lc files to transmitter. Do not run dumper in 14/16 where memory is limited.

  • Install and run the Dumper.lua as any other app
  • Uninstall all Lua-apps from model
  • Backup all your .lua files just in case, do not remove them yet from Apps-folder
  • Run the app, select compile
  • Remove the .lua files from Apps-folder (You did take the backup, right?)
  • Install the apps (.lc) as usual

After installation:

Run the app:

Select the “Compile apps and dump” and confirm:

After the app have done the work it will go to start without any other information. You can of course jump to console and have a look:

After you have run the app take a look in to Apps-folder. You have both the App.lua and App.lc files there. Remove the .lua files (You do have backups, right?) and simply use the .lc files as you would use .lua files.

Really simple!

2 thoughts on “Precompile Lua-apps, save a lot of memory!

  1. Tero, is the app dumper script no longer needed? It appears to have disappeared from github.

    Thanks

    1. If you use only Jeti Studio then then you don't need it. But if you write your own lua-apps it's very much usable. And it is still available, have a look here: https://github.com/JETImodel/Lua-Apps

Leave a Reply

Your email address will not be published. Required fields are marked *