Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 32 lines (24 sloc) 0.541 kB
5b3c101 created benchmark suite for object delivery and consumption
Tyler Riddle authored
1 package EventBench::ObjectMethod::Array;
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, $arg1, $arg2) = @_;
13 our $sum;
14
15 $sum += $arg1 + $arg2;
16 }
17
18 return sub {
19 my (@testData) = @_;
20 my $test = EventBench::ObjectMethod::Array->new;
21 our $sum = 0;
22 my $bench;
23
24 $bench = timeit(1, sub {
25
26 foreach(@testData) {
27 $test->receive_event($_->[0], $_->[1]);
28 }
29 });
30
31 return { bench => $bench, sum => $sum };
32 };
Something went wrong with that request. Please try again.