lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Vaughan McAlley <vaughan <at> mcalley.net.au> writes:

>     -- extreme slow
> 	TableConcat=function()
> 		local t,a,s='A','#',5
> 		local n=""
> 		for i=1,1000 do
> 			n=table.concat{"\symbol{circled",s,"}=",t,a,i}
> 		end
> 	end,
> 
> This code creates 1000 identical tables. Maybe defining it once at the
> beginning of the function would be closer the way we normally use
> table.concat- where table creation is a trivial part of building a
> long string.

* Those tables are /not/ identical. Take a close look, they all differ in the
last element.

and

* this is just an example how one could use Benchmark. 

In my real case the result is processed seperately [code]
dosomethingwith(format("\\symbol{circled%d}=%s",s,toa)) [/code], where s and toa
may vary and my intend was to find out, how to generate these string parameters
fastest. 

Regards Jørgen