* * * * *

                 Perhaps an 80M script isn't that excessive …

Okay, I played around a bit with the Lua code from last night. Here, again,
is the six minute run:

> [spc]lucy:/tmp/lua>time lua -i show.lua
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> > dofile("default.lua")
> > os.exit()
>
> real    5m49.052s
> user    5m43.279s
> sys     0m0.577s
> [spc]lucy:/tmp/lua>
>

show.lua is some code to display a given table, and it's only being used here
to see if the code actually built the huge table up correctly.

Okay, six minutes. I'm not sure what prompted me to do the following, but I
did it anyway:

> [spc]lucy:/tmp/lua>time lua -i default.lua
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> > dofile("show.lua")
> > os.exit()
>
> real    0m12.354s
> user    0m6.293s
> sys     0m0.413s
> [spc]lucy:/tmp/lua>
>

Oooohkaaaaay … what happend here? To make matters more interesting, it's
repeatable. I load show.lua (at 1,101 bytes) first, and it takes six minutes.
Load default.lua (the 80MB (Megabyte) file) and it takes 12 seconds. And if I
do it this way:

> [spc]lucy:/tmp/lua>time lua
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> > dofile("show.lua")
> > dofile("default.lua")
> > os.exit()
>
> real    0m16.130s
> user    0m6.311s
> sys     0m0.365s
> [spc]lucy:/tmp/lua>
>

and it takes 16 seconds (only because it took me an additional four seconds
to type the extra line of code).

Very weird.

Update Wednesday, February 3^rd, 2010

It was a bug in Lua that has since been fixed [1].


[1] gopher://gopher.conman.org/0Phlog:2010/02/03.1

Email author at [email protected]