[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Re[2]: Lua 5.1 (work2) now available
- From: "Steve Donovan" <sjdonova@...>
- Date: Thu, 04 Nov 2004 14:25:21 +0200
>>> sjdonova@csir.co.za 11/04/04 02:08PM >>>
> Looking at the implementation of table.insert, this may not be
> optimal, but I don't think tbl[kk] = val; kk = kk + 1 is
> going to be much faster
Hm, always a good idea to run tests before giving an
opinion!
-- adding by index
local tbl = {}
local k = 1
for i = 1,1000000 do
tbl[k] = i
k = k + 1
end
-- using append
local append = table.insert
local tbl = {}
for i = 1,1000000 do
append(tbl,i)
end
Well, the first snippet is about four times as fast!
steve d.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.