[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: pairsBykeys() with coroutines
- From: <mail@...>
- Date: Tue, 16 Nov 2010 11:24:28 +0100
Hi,
On Tue, 16 Nov 2010 09:20:05 +0100
Michal Kolodziejczyk <miko@wp.pl> wrote:
> >>> can someone show me how to (re-)implement the
> >>> pairsByKeys()-iterator from PIL sorting chapter (19.3) using
> >>> coroutines?
> >>
> >> Hmmm... not sure if this makes much sense, but, for example:
> >>
> > Thank you very much.
> > Made some minor/simple performance measurements and it seems like
> > it makes not much difference even for very very big tables.
>
> So what were you expecting then, and why?
Not much, was just looking for the "best" (in sense of easy to
understand code) and/or "fastest" implementation to iterate over
(sorted) table keys of very big tables.
> The coroutines version adds
> a slight overhead with yield/resume (its like calling a function).
Overhead, compared to the closure based implementation from PIL?
Okay, good to know, that I did not expect.
For some reason I expected coroutines to be slightly faster.
I'm coming from C background and I'm not so familiar with
closures (somewhat black magic for me), thus the coroutines idea at
first looked like the more natural approach to me, but I learned the
lesson and started to appreciate closures.
> You may be mistaking coroutines with system threads;
No.
> for that you
> should check luaproc, concurrentlua, alua, lua lanes etc. Check this
> out: http://kotisivu.dnainternet.net/askok/bin/lanes/comparison.html
>
> (but then watch out for message passing/communication/serialization
> overhead)
Sure, thanks, but no ;)
Regards,
Jörg