[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Virtual machine
- From: "Mauro Vezzosi"<mvezzosi@...>
- Date: Mon, 28 Aug 2000 17:16:00 +0200
> But for more "real" programs (such as life.lua), `luaV_execute'
> gets ~20% of the time, hash indexing (luaH_get and relatives)
> gets other 20%, and the other 60% goes to many small tasks, each
> taking less then 5% (string manipulation, garbage collection,
> library calls, etc.).
For example, you can speed up Life.lua about twice adding a temporary
variable (out2) to collect the character to write out:
-- output the array to screen
local out="" -- accumulate to reduce flicker
while y <= self.h do
local out2="" -- new variable
while x <= self.w do
out2=out2..(((self[y][x]>0) and ALIVE) or DEAD)
This new version reduces the length of the used strings, therefore
reduces also the frequency of the garbage collection.
Hopefully Life.lua given with Lua 4.0 beta will use the For statement.