[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: iterators
- From: spir <denis.spir@...>
- Date: Tue, 17 Nov 2009 17:46:44 +0100
Le Tue, 17 Nov 2009 08:31:39 -0500,
Jim Pryor <lists+lua@jimpryor.net> stated:
> On Tue, Nov 17, 2009 at 08:23:24AM -0500, Jim Pryor wrote:
> > If you only have one
> > loop---it doesn't matter how many iteration steps it involves---then
> > only one object is getting created and so the garbage collection costs
> > will be negligible. You're basically just testing here how much it slows
> > down a function to lookup its upvalues. And the answer is, hardly any
> > slowdown.
>
> Sorry, I looked at your code again. I was wrong. You're not just running
> through a single loop for each case, you are correctly creating the loop
> multiple times.
>
> However, your testing code doesn't do anything to manage when the
> garbage collection costs are incurred. So for that reason you can't rely
> on it for insight into the performance costs at issue here.
>
> It would be better to insert a
> collectgarbage("collect")
> before the
> print(os.time()-t0)
> in each block.
Thank you for the hint. (Next time I need to time something, I'll probably think at including GC if relevant).
Denis
--------------------------------
* la vita e estrany *
http://spir.wikidot.com/