[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: The Lua interpreter and large scripts
- From: Sean Conner <sean@...>
- Date: Tue, 10 Nov 2009 05:46:37 -0500
I've noticed some strange behavior with the Lua interpreter [1]. I'm
trying to load two scripts, one is 1101 bytes in size (just dumps the
contents of a table) and the other one is 83414279 bytes in size (yes,
80M---generated by a C program and contains a *really* large table of around
80,000 items [2]).
[spc]lucy:/tmp/lua>ll
total 81548
-rw------- 1 spc spc 83414279 Nov 10 05:30 default.lua
-rw-r--r-- 1 spc spc 1101 Nov 10 05:30 show.lua
Okay.
[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>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 # file is probably cached at this point
user 0m6.293s
sys 0m0.413s
[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 # okay ... what happened?
user 5m43.279s
sys 0m0.577s
[spc]lucy:/tmp/lua>
I can work around this, but I'm very curious as to why it's happening.
-spc (Who finds this very odd behavior ... )
[1] Linux 2.6, dual core Pentium-4 2.6GHz with a 1G of RAM
[2] Basically, an index of all the headers from over 80,000 messages
from 2,300 files (of which the names, sizes and timestamps are
saved as well in the table).