ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/eg/bench
(Generate patch)

Comparing Coro/eg/bench (file contents):
Revision 1.4 by root, Tue Jul 17 00:24:15 2001 UTC vs.
Revision 1.5 by root, Tue Jul 17 15:42:28 2001 UTC

12 12
13 13
14sub a { 14sub a {
15 $n++; # do something to taint the benchmark results ;) 15 $n++; # do something to taint the benchmark results ;)
16} 16}
17$|=1;
18 17
19$b = async { 18$b = async {
20 # do a little unrolling... 19 # do a little unrolling...
21 while() { 20 while() {
22 yield; yield; yield; yield; yield; 21 yield; yield; yield; yield; yield;
29 28
30*transfer = \&Coro::State::transfer; 29*transfer = \&Coro::State::transfer;
31 30
32$c = Coro::State::_newprocess [sub { 31$c = Coro::State::_newprocess [sub {
33 while() { 32 while() {
33 # some unrolling here as well..
34 transfer($c, $main); transfer($c, $main);
34 transfer($c, $main); transfer($c, $main); 35 transfer($c, $main); transfer($c, $main);
35 transfer($c, $main); transfer($c, $main); 36 transfer($c, $main); transfer($c, $main);
36 } 37 }
37}]; 38}];
38 39
39transfer($main, $c); 40transfer($main, $c);
40 41
41timethese 100000, { 42timethese 100000, {
42 method => '$a->a; $a->a; $a->a; $a->a', 43 method => '$a->a; $a->a',
43 resume => 'yield; yield', 44 resume => 'yield',
44 transfer => 'transfer($main, $c); transfer($main, $c)', 45 transfer => 'transfer($main, $c)',
45}; 46};
47

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines