[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Limited dostring()?
- From: Tom Wrensch <twrensch@...>
- Date: Wed, 9 Jan 2002 10:04:21 -0800 (PST)
Roberto wrote:
> As a rule, you should always avoid using dostring if you can (it is too
> expensive). A better way to do what you want is with getglobal:
Yes, it is more expensive. On my machine (W2K 750MHz PIII) this code:
for i=1,100000 do
local f = getglobal("Test_Version")
f()
end
Executed in 0.12 seconds, while this code:
for i=1,100000 do
dostring("return Test_Version()")
end
Executed in 1.262 seconds.
So about a factor of 10 slower.
However, I have to say that 12.62 microseconds to execute the
"dostring" version is pretty darn fast, plenty fast enough for many
situations.
- Tom Wrensch