Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 31 lines (24 sloc) 0.557 kB
5b3c101 created benchmark suite for object delivery and consumption
Tyler Riddle authored
1 package EventBench::ObjectMethod::Hash;
2
3 use strict;
4 use warnings;
5 use Benchmark ':hireswallclock';
6
7 sub new {
8 return bless({}, $_[0]);
9 }
10
11 sub receive_event {
12 my ($self, %event) = @_;
13 our $sum;
14
15 $sum += $event{arg1} + $event{arg2};
16 }
17
18 return sub {
19 my (@testData) = @_;
20 my $test = EventBench::ObjectMethod::Hash->new;
21 our $sum = 0;
22 my $bench;
23
24 $bench = timeit(1, sub {
25 foreach(@testData) {
26 $test->receive_event(arg1 => $_->[0], arg2 => $_->[1]);
27 }
28 });
29
30 return { bench => $bench, sum => $sum };
31 };
Something went wrong with that request. Please try again.