[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: optimisation question
- From: Philippe Lhoste <PhiLho@...>
- Date: Fri, 4 Jul 2003 10:16:30 +0200 (MEST)
> > > Both runs on the same speed and profiling tells that most time spent
in
> > > a [for] loop.
>
> As it turns out, my profiling was a bit wrong.
> But stills, the results are rather close.
Out of curiosity, how do you do your profiling? I use the classical time
spent between the start and the end
of a code fragment, but running on Win98, results are not consistent from
one call to the next, sometime
even inverting results. I choose the most frequent result... Alas, on
Windows, we don't have access to CPU
time of a process.
> > or even better, make:
> > local t = {}
> > for i = n1, n2 do
> > t[i] = i
> > end
> > return table.concat(t, ",", n1, n2)
>
> > a little faster, doing less computing...
>
> > Tell me if it is better, using your profiling.
>
> On my data (the most typical range is about 6 elements) it is a little
> SLOWER than string.format or concat version: 0.18 vs 0.16 for 1000
> calls on range with 6 elements and 0.72 vs 0.62 on range with 100
> elements.
Slower than the concat version? It *is* the concat version, I just avoid the
call to table.insert, and
unecessary computations. I am puzzled.
--
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
Jetzt ein- oder umsteigen und USB-Speicheruhr als Prämie sichern!