Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 36 lines (27 sloc) 0.565 kb
8854a861 »
2012-06-04 Add a benchmark for re_emit(), which helps profile event cloning.
1 #!/usr/bin/env perl
2
3 # A program to benchmark and/or profile event creation and
4 # destruction.
5 #
6 # Sample usage:
7 #
8 # perl -d:NYTProf bench-event.pl
9 # nytprofhtml
10 # open nytprof/index.html
11
12 use warnings;
13 use strict;
14
15 {
16 package Thing;
17 use Moose;
18 extends 'Reflex::Base';
19
20 sub test {
21 my ($self, $event) = @_;
22
23 my $i = 100_000;
24 while ($i--) {
25 $self->re_emit($event, -name => "re_emitted");
26 }
27 }
28
29 __PACKAGE__->meta->make_immutable;
30 }
31
32 use Reflex::Event;
33 my $t = Thing->new();
34
35 $t->test( Reflex::Event->new( _name => "generic", _emitters => [ ] ) );
Something went wrong with that request. Please try again.