… | |
… | |
32 | *transfer = \&Coro::State::transfer; |
32 | *transfer = \&Coro::State::transfer; |
33 | |
33 | |
34 | sub doit0 { |
34 | sub doit0 { |
35 | while() { |
35 | while() { |
36 | # some unrolling here as well.. |
36 | # some unrolling here as well.. |
37 | transfer($c0, $main); transfer($c0, $main); |
37 | transfer($c0, $main, 0); transfer($c0, $main, 0); |
38 | transfer($c0, $main); transfer($c0, $main); |
38 | transfer($c0, $main, 0); transfer($c0, $main, 0); |
39 | transfer($c0, $main); transfer($c0, $main); |
39 | transfer($c0, $main, 0); transfer($c0, $main, 0); |
40 | } |
40 | } |
41 | } |
41 | } |
42 | |
42 | |
43 | sub doit1 { |
43 | sub doit1 { |
44 | while() { |
44 | while() { |
45 | # some unrolling here as well.. |
45 | # some unrolling here as well.. |
46 | transfer($c1, $main); transfer($c1, $main); |
46 | transfer($c1, $main, -1); transfer($c1, $main, -1); |
47 | transfer($c1, $main); transfer($c1, $main); |
47 | transfer($c1, $main, -1); transfer($c1, $main, -1); |
48 | transfer($c1, $main); transfer($c1, $main); |
48 | transfer($c1, $main, -1); transfer($c1, $main, -1); |
49 | } |
49 | } |
50 | } |
50 | } |
51 | |
51 | |
52 | $c0 = Coro::State::_newprocess [sub { |
52 | $c0 = Coro::State::_newprocess [sub { |
53 | doit0(1,2,3,4,5,6,7,8,9); |
53 | doit0(1,2,3,4,5,6,7,8,9); |
… | |
… | |
55 | |
55 | |
56 | $c1 = Coro::State::_newprocess [sub { |
56 | $c1 = Coro::State::_newprocess [sub { |
57 | doit1(1,2,3,4,5,6,7,8,9); |
57 | doit1(1,2,3,4,5,6,7,8,9); |
58 | }]; |
58 | }]; |
59 | |
59 | |
60 | transfer($main, $c0); |
60 | transfer($main, $c0, 0); |
61 | transfer($main, $c1); |
61 | transfer($main, $c1, -1); |
62 | |
62 | |
63 | timethese 100000, { |
63 | timethese 100000, { |
64 | empty => '&a; &a', |
64 | empty => '&a; &a', |
65 | method => '$a->b(5); $a->b(6)', |
65 | method => '$a->b(5); $a->b(6)', |
66 | cede => 'cede', |
66 | cede => 'cede', |
67 | transfer0=> 'transfer($main, $c0, 0)', |
67 | transfer0=> 'transfer($main, $c0, 0)', |
68 | transfer1=> 'transfer($main, $c1)', |
68 | transfer1=> 'transfer($main, $c1, -1)', |
69 | }; |
69 | }; |
70 | |
70 | |