Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: ssmccoy/AnyEvent-Blackboard
base: ef7c1df132
...
head fork: ssmccoy/AnyEvent-Blackboard
compare: 25dc732340
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jun 22, 2012
@ssmccoy Added benchmark tests.
 * If the clone and dispatch rate drops below 30000/second the test will fail.
ad99476
@ssmccoy Added EV as a prerequisite (for testing).
 * Build.PL now demands EV.pm is present.
bffd918
@ssmccoy Documentation cleanup.
 * Removed rouge "=for <type>" statements.
 * Corrected bug in synopsis.
8a22ab8
@ssmccoy Bumped version to 0.3.2 25dc732
Showing with 47 additions and 19 deletions.
  1. +4 −1 Build.PL
  2. +8 −18 lib/AnyEvent/Blackboard.pm
  3. +35 −0 t/02_benchmarks.t
View
5 Build.PL
@@ -7,7 +7,10 @@ my $build = Module::Build->new(
version_from => "AnyEvent::Blackboard",
requires => {
AnyEvent => 0,
- Mouse => 0
+ Mouse => 0,
+
+ # For test....
+ EV => 0,
},
);
View
26 lib/AnyEvent/Blackboard.pm
@@ -14,7 +14,7 @@ AnyEvent::Blackboard - A simple blackboard database and dispatcher.
$blackboard->put(foo => "First dispatch");
# $object->found_foo("First dispatch") is called
$blackboard->put(bar => "Second dispatch");
- # $object->found_foobar("Second dispatch") is called
+ # $object->found_foobar("First dispatch", "Second dispatch") is called
$blackboard->clear;
@@ -27,7 +27,7 @@ AnyEvent::Blackboard - A simple blackboard database and dispatcher.
# Order of the following is undefined:
#
# $object->found_foo("Future dispatch") is called
- # $object->found_foobar("Another dispatch") is called
+ # $object->found_foobar("Future Dispatch", "Another dispatch") is called
$blackboard->hangup;
@@ -51,13 +51,9 @@ use Mouse;
use AnyEvent;
-our $VERSION = 0.3.1;
+our $VERSION = 0.3.2;
-=for ATTRIBUTES
-
-=over 4
-
-=for _objects
+=for comment
The _objects present in this blackboard instance.
@@ -69,7 +65,7 @@ has _objects => (
default => sub { {} }
);
-=for _watchers
+=for comment
A hash reference of callbacks for each watcher, with the key for the watcher as
its key.
@@ -82,7 +78,7 @@ has _watchers => (
default => sub { {} }
);
-=for _interests
+=for comment
A hash table with which has each watcher as a key, and array reference to an
array of interested keys as a value.
@@ -95,7 +91,7 @@ has _interests => (
default => sub { {} }
);
-=for _hangup -> Bool
+=for comment
The hangup flag.
@@ -492,16 +488,10 @@ sub clone {
return $clone;
}
-=item complete
-
-
+return __PACKAGE__;
=back
-=cut
-
-return __PACKAGE__;
-
=head1 BUGS
None known.
View
35 t/02_benchmarks.t
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings FATAL => "all";
+use Test::More;
+use Benchmark qw( :all );
+use AnyEvent::Blackboard;
+
+my $blackboard = AnyEvent::Blackboard->build(
+ watch => [ test => \&pass ]
+);
+
+sub rate {
+ my ($benchmark) = @_;
+ # This copies some funk from the Benchmark internals, which I should say
+ # are not particularly legible.
+ my ($r, $pu, $ps, $cu, $cs, $n) = @$benchmark;
+
+ my $elapsed = $cu + $cs + $pu + $ps;
+
+ return $n / $elapsed;
+}
+
+
+subtest "Dispatch" => sub {
+ my $benchmark = timeit 100_000, sub {
+ $blackboard->clone->put(test => 1);
+ };
+
+ my $rate = rate($benchmark);
+
+ ok $rate > 30000, "Rate of $rate is above 30,000/second";
+};
+
+done_testing;

No commit comments for this range

Something went wrong with that request. Please try again.