Coro benchmarks ?
sparky at pld-linux.org
Sun May 1 15:24:12 CEST 2011
On Sat, Apr 30, 2011 at 06:20:42AM +0200, Marc Lehmann wrote:
> On Fri, Apr 29, 2011 at 09:53:42PM +0200, Przemyslaw Iskra <sparky at pld-linux.org> wrote:
> > Are there some good benchmarks for coro to test how blocking is some
> > thread / module / whatever ?
> If you ever find a method on how to benchmark some API without knowing it
> let us know :)
I was thinking about something like "total running time" vs "time spent
outside coro idle process", since "cpu time" won't really tell me how
much did my module take.
> If you want to make it utmost efficient, you can always add, say, an XS
> interface to EV with fallback to plain AE.
> But using AE (I mean the AE:: namespace, not AnyEvent) on the perl level
> will already gie you the highets speed possible.
The nice thing about EV that AE does not have is that I can register a
socket for both reading and writing and it tells me which of those
happened. I haven't seen libcurl yet to require both at once, but it
could do it, so I have to account for such possibility and it somewhat
complicates the design.
> AnyEvent will give your module the widest possible audience, much better
> than Coro, and will fit into Coro automatically.
Got that. Furthermore, it is very unlikely for people to have Coro and
not AnyEvent, so there is not much point in targetting Coro directly.
> Now, with regrds to curl - last I looked, the libcurl interface basically
> forces you to use select, as it doesn't tell you about fd lifetimes, so
> using it with a stateful backend such as kqueue or epoll will suck (you
> have tod estroy and recreate all watchers in each iteration). The existing
> Curl perl interface modules don't even give you a timeout or anything, so
> you more or less will have to write your own.
> OTOH, there already is AnyEvent::Curl and AnyEvent::Curl::Multi - maybe
> improving WWW::Curl to add timeout functionality and then improving that
> might be the better way.
Well, I did that, and sent patches to WWW::Curl maintainer.
However, I found there was a room for many more improvements, some of
them incompatible with WWW::Curl, so I rewrote the module almost
entirely and released as Net::Curl.
Reasonably recent libcurl provides callbacks which notify on socket
status change and timeout change, while calling them only when
necessary. This is just perfect for integration with event libraries.
____ sparky -- Przemyslaw ................ LANG...Pl,Ca,Es,En
/____) ___ ___ _ _ || Iskra : WWW . http://ppcrcd.pld-linux.org/
\____\| -_)'___| ||^'||//\\// : WWW2 ............ http://rsget.pl/
(____/|| (_-_|_|| ||\\ || : eMail ..... <sparky at pld-linux.org>
More information about the anyevent