Opened 3 years ago

Closed 3 years ago

#18082 closed enhancement (not_a_bug)

Minification of LUA scripts

Reported by: dev.rindeal+dev.openwrt@… Owned by:
Priority: normal Milestone:
Component: luci Version: Barrier Breaker 14.07
Keywords: Cc:



there isn't much free space on my Tp-Link TL-WR741ND after an openwrt installation and thus I've been looking for ways how to shrink the files need to keep the overall functionality. After a while I've found all the comments and spaces in luci lua scripts.

Using a lua minifier ( I was able to shrink the size of scripts from ~550kB to ~390kB and I think that's a considerable saving of space.

Minified Luci runs on my router without any issues so far.

Attachments (0)

Change History (7)

comment:1 Changed 3 years ago by bittorf@…

how much does it safe on storage (compressed JFFS2)?
talk about your workflow, how do you applied it?

comment:2 Changed 3 years ago by rindeal

I've changed the files "on-the-fly" via scp. To be exact: download->minify->upload

comment:3 Changed 3 years ago by rindeal

I don't know how to measure directory size on JFFS2, but using "du -cd 0" for "/usr/lib/lua" dir, I get results 1412kB vs 1205kB

comment:4 Changed 3 years ago by jow

Keep in mind that LuCI is heavily compressed by LZMA when being builtin as part of the squashfs. The comment blocks are extremely redundant and thus compressed away to nearly nothing. I think you'll not even save a single block by compressing/stripping the Lua files.

Comparing the sizes reported by du / df / ls etc. are meaningless as they do not account for the transparent compression.

comment:5 Changed 3 years ago by rindeal

Ok, I don't want to create a custom built with minified lua files right now, but when I extracted all lua scripts from "/usr/lib/lua" and created an 7zip archive with ultra LZMA compression, the results were: 303kB vs 287kB.

comment:6 Changed 3 years ago by rindeal

I've also spotted that luci views are not minified, including inline javascripts, lua and html of course.

Last edited 3 years ago by rindeal (previous) (diff)

comment:7 Changed 3 years ago by nbd

  • Resolution set to not_a_bug
  • Status changed from new to closed

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.