how to reduce the bytecode size, or perhaps it's a bug?

  • From: Weebeen Peng <bkfowaphew@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 27 Nov 2013 13:44:46 +0800

g_tbl = {
    {id=1, name="test1"},
    {id=2, name="test2"},
    {id=3, name="test3"},
    ...
}

look at g_tbl, it contents a lot of table elements, their key is exactly
the same.
when i compiled it to luajit bytecode, i found the bytecode save every  key
for every table element, this is not like lua, lua save key only once.

so, the luajit bytecode size is bigger than lua, the more table elements,
the size is bigger.
how to reduce the bytecode size, or perhaps this is a bug?

sorry for my bad english.

this is a demo
 test.lua  is source file          (174411bytes)
 test.luac is lua bytecode file    (111481bytes)
 test.luaj is luajit bytecode file (154394bytes, bigger than luac)

Attachment: test.zip
Description: Zip archive

Other related posts: