… | |
… | |
6 | # call with two calls of transfer in a loop. |
6 | # call with two calls of transfer in a loop. |
7 | |
7 | |
8 | use Coro; |
8 | use Coro; |
9 | use Benchmark; |
9 | use Benchmark; |
10 | |
10 | |
11 | sub a() { } |
11 | sub a($) { } |
12 | |
12 | |
13 | $a = bless {}, main::; |
13 | $a = bless {}, main::; |
14 | |
14 | |
15 | sub b { |
15 | sub b { |
16 | my ($self) = shift; |
16 | my ($self) = shift; |
… | |
… | |
35 | while() { |
35 | while() { |
36 | # some unrolling here as well.. |
36 | # some unrolling here as well.. |
37 | transfer($c0, $main, 0); transfer($c0, $main, 0); |
37 | transfer($c0, $main, 0); transfer($c0, $main, 0); |
38 | transfer($c0, $main, 0); transfer($c0, $main, 0); |
38 | transfer($c0, $main, 0); transfer($c0, $main, 0); |
39 | transfer($c0, $main, 0); transfer($c0, $main, 0); |
39 | transfer($c0, $main, 0); transfer($c0, $main, 0); |
|
|
40 | transfer($c0, $main, 0); transfer($c0, $main, 0); |
40 | } |
41 | } |
41 | } |
42 | } |
42 | |
43 | |
43 | sub doit1 { |
44 | sub doit1 { |
44 | while() { |
45 | while() { |
45 | # some unrolling here as well.. |
46 | # some unrolling here as well.. |
|
|
47 | transfer($c1, $main, -1); transfer($c1, $main, -1); |
46 | transfer($c1, $main, -1); transfer($c1, $main, -1); |
48 | transfer($c1, $main, -1); transfer($c1, $main, -1); |
47 | transfer($c1, $main, -1); transfer($c1, $main, -1); |
49 | transfer($c1, $main, -1); transfer($c1, $main, -1); |
48 | transfer($c1, $main, -1); transfer($c1, $main, -1); |
50 | transfer($c1, $main, -1); transfer($c1, $main, -1); |
49 | } |
51 | } |
50 | } |
52 | } |
… | |
… | |
59 | |
61 | |
60 | transfer($main, $c0, 0); |
62 | transfer($main, $c0, 0); |
61 | transfer($main, $c1, -1); |
63 | transfer($main, $c1, -1); |
62 | |
64 | |
63 | timethese 1000000, { |
65 | timethese 1000000, { |
64 | empty => '&a; &a', |
66 | function => 'a(5); a(6)', |
65 | method => '$a->b(5); $a->b(6)', |
67 | method => '$a->b(5); $a->b(6)', |
66 | cede => 'cede', |
68 | cede => 'cede', |
67 | transfer0=> 'transfer($main, $c0, 0)', |
69 | transfer0 => 'transfer($main, $c0, 0)', |
68 | transfer1=> 'transfer($main, $c1, -1)', |
70 | transfer1 => 'transfer($main, $c1, -1)', |
69 | }; |
71 | }; |
70 | |
72 | |
|
|
73 | |
|
|
74 | |