Author Topic: LuaSrcDiet  (Read 5834 times)

0 Members and 1 Guest are viewing this topic.

Offline NecroBumpist

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 130
  • Rating: +14/-5
  • Master of Lua
    • View Profile
LuaSrcDiet
« on: August 21, 2011, 12:51:13 pm »
NOTE: I did not make this, but since the NSpire does not have gigabytes of memory, I though I would share it with you guys

LuaSrcDiet

I found this project a while back (It's made by the author of ANoFrillsIntroToLua51VMInstructions.pdf), and I think it could be of use for NSpire Lua developers.

Basically, what it does is it removes as much unnecessary information as possible.
This means removing whitespace, comments, and renaming/reusing variables whenever possible.

I just used it again on a script of mine that was 38,513 bytes long.
It outputted a file 21,899 bytes long.
That's a 41% reduction

Everything should run the same. (Though if you have an error it might be harder to figure out which variable it was really from)

So if you're looking to save space in large projects of yours, you might want to give this a try :)
Developing Lua scripts for the NSpire ?
Check out the Necrotorium
Need a few routines to run faster ? Checkout the MODS Lua Assembly Toolkit.
Need to save space for your scripts ? Checkout LuaSrcDiet

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: LuaSrcDiet
« Reply #1 on: August 21, 2011, 01:02:18 pm »
Thanks for that link, definitely interesting !

I thought about making something like that before but never had the courage to actually code it...

:P
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: LuaSrcDiet
« Reply #2 on: August 21, 2011, 04:42:52 pm »
Yeah, very nice!
Thanks for the link :)

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: LuaSrcDiet
« Reply #3 on: August 22, 2011, 12:02:24 am »
So, you use this like you would the -O2 option on gcc: For finished products. Having problems catching bugs is fine once all the bugs are gone :P

Nice find!