[LEDE-DEV] [PATCH] LuaSrcDiet call define for lua code Minifying

Sebastian Moeller moeller0 at gmx.de
Thu Oct 6 03:39:15 PDT 2016


Hallo Jan-Tarek,

Is it true that the mini fixation will make the scripts much harder for a human to parse/understand? If so I humbly believe this makes a great option for people trying to build firmwares for say 4MB flash devices, but seems way more dubious for devices with less extreme storage configurations. The downside is that any serious debugging will now require access to a source code repository making casual debugging via ssh access to a router much harder. The beauty of interpreted languages like lua and shell IMHO is exactly that they offer easy tinkering with...
That said, as a non-default option this seems interesting, assuming that mini fixation actually reduces the size of the compressed firmware image. Do you by chance have numbers showing how much full lua minification reduces the minimum required partition size?

Best Regards
Sebadtian

P.S.: Sorry for the previous html response, forgot to configure k9...

On October 2, 2016 10:37:35 PM GMT+02:00, Jan-Tarek Butt <tarek at ring0.de> wrote:
>Hi,
>
>This patch makes able to minify lua code sequential inside directories.
>Here is an example how do can call it in package Makefiles:
>
>Just call the following command inside the package
>compile define.
>$(call LuaSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
>
>luasrc can have subdirectorys there will also created inside luadest
>including its minifyed files.
>
>As an example how good it will woke. I minifyed the Nordwest Freifunk
>hoodselector[0]. This lua file have currently around 680 lines and a
>size
>of 22042 Bytes after minifying it has just 9480 Bytes.
>
>Here is a table of the minifying process:
>
>--------------------------------------------------------------------
>Lexical            Input   Input     Input  Output  Output    Output
>Elements           Count   Bytes   Average   Count   Bytes   Average
>--------------------------------------------------------------------
>TK_KEYWORD           526    1958      3.72     526    1958      3.72
>TK_NAME              813    5506      6.77     813    1984      2.44
>TK_NUMBER             35      36      1.03      35      36      1.03
>TK_STRING            246    3379     13.74     246    3379     13.74
>TK_LSTRING             0       0      0.00       0       0      0.00
>TK_OP               1276    1356      1.06    1276    1356      1.06
>TK_EOS                 1       0      0.00       1       0      0.00
>--------------------------------------------------------------------
>TK_COMMENT           137    6982     50.96       1      14     14.00
>TK_LCOMMENT            0       0      0.00       0       0      0.00
>TK_EOL               676     676      1.00     466     466      1.00
>TK_SPACE            1187    2149      1.81     287     287      1.00
>--------------------------------------------------------------------
>Total Elements      4897   22042      4.50    3651    9480      2.60
>--------------------------------------------------------------------
>Total Tokens        2897   12235      4.22    2897    8713      3.01
>--------------------------------------------------------------------
>
>cheers
>Tarek
>
>[0]
>https://git.nordwest.freifunk.net/ffnw-firmware/packages/raw/master/hoodselector/luasrc/hoodselector
>
>Jan-Tarek Butt (1):
>  add luaSrcDiet call define to package.mk
>
> include/package.mk | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)




More information about the Lede-dev mailing list