Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • So, how MUCH faster? :)

    • Sorry, no fancy graphs.

      I wrote a deliberately simple program to count select_read() events per second. I ran it five times for each version of POE, averaged the results, and calculated the improvement using (new_rate/old_rate-1). Standard deviation for the sample sets were about 1%, if that matters.

      #!/usr/bin/env perl

      use warnings;
      use strict;

      use POE;

      my $limit = 10_000;
      my @start_times;
      my @end_times;
      my $count = 0;

      my $filehandle;

      POE::Session->create(
        inline_states => {
          _start => sub {
            open $filehandle, "<", "/dev/zero" or die $!;
            $_[KERNEL]->select_read($filehandle, "count");
            @start_times = times();
          },
          count  => sub {
            if ($count < $limit) {
              $count++;
              return;
            }

            @end_times = times();
            for (0..$#end_times) {
              $end_times[$_] -= $start_times[$_];
            }

            $_[KERNEL]->select_read($filehandle, undef);
          },
        },
      );

      POE::Kernel->run();

      print join("\t", "POE", "BENCH", "COUNT", "RATE"), "\n";
      print join(
        "\t",
        $POE::VERSION,
        "io/cpusec",
        $limit,
        sprintf("%.2f", $limit / ($end_times[0] + $end_times[1])),
      ), "\n";

      I don't have a methodology to test the mark-and-sweep garbage collection in isolation. Got any ideas?