Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^2: IO::Lambda - suggestions wanted

by dk (Chaplain)
on Jul 09, 2008 at 05:42 UTC ( #696385=note: print w/replies, xml ) Need Help??

in reply to Re: IO::Lambda - suggestions wanted
in thread IO::Lambda - suggestions wanted

You're right, there's no benchmarks, thanks for the tip, I'll go for that. As for the lambda, it seemed somewhat natural for me back then - anonymous callback bound to IO... OTOH there would be no problem to make the lambda keyword an alias to another, less confusing name, so the only question is what that name should be? new_io_chain ? Doesn't sound... don't know really.

update: here's some premature benchmarks. the source code will be added to the next release, for now it's here

Single-process tcp client and server; server echoes back everything is sent by the client. 500 connections sequentially created, instructed to send a single line to the server, and destroyed.

                        2.4GHz x86-64 linux
  Lambda using select       0.694 sec
  Lambda using AnyEvent     0.684 sec
  Raw sockets using select  0.145 sec
  POE using select          5.349 sec
the POE numbers are somewhat strange. I might've done something wrong there, anyone interested is welcome to check from the link above.

Replies are listed 'Best First'.
Re^3: IO::Lambda - suggestions wanted
by vrk (Chaplain) on Jul 09, 2008 at 09:30 UTC

    Why not aio (asynchronous/anonymous i/o) or simply io? It's all about I/O, not about the particular construct (a lambda), right? A couple of examples rewritten with the new keyword:

    my $q = io { print "Hello world!\n" }; $q->wait; $q = io { context io { 2 }, io { 3 }; tails { sort @_ }; }; print $q->wait;

    Of course, you would need to rename the current io predicate to something else; perhaps io_trigger?

    I also suggest moving the Stream I/O section near the beginning of the documentation file. Yes, the mathematically logical order is to introduce low-level things first, then define high-level things using them, but my interest was only sparked after reading the Stream I/O section. Unfortunately it's at the bottom, and I suspect many people will stop reading or browsing before reaching it.

    Alternatively, move the high-level examples to the synopsis before the low-level ones. The low-level examples are mostly toy examples. If you can't think of any better ones right now, remove them. For instance, why would I want to create a "pipeline that waits for 2 lambdas"?

    print "Just Another Perl Adept\n";

      Yes, aio or io could be ok. And short also. Renaming original io to something else shouldn't be big deal, it's there for the completeness sake, and it also appeared not as usable as read and write anyway.

      Other than that, thank you, - I suspected that manual has too much to say until the real fun begins, but couldn't put my finger on where.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://696385]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-10-23 00:31 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (275 votes). Check out past polls.