@@ -29,25 +29,25 @@ def tarai(x, y, z) =
29
29
system ( "go version" , exception : true )
30
30
31
31
Benchmark . ips do |x |
32
- # sequential version
33
- x . report ( "sequential" ) { 4 . times { tarai ( 14 , 7 , 0 ) } }
32
+ # Ruby: sequential version
33
+ x . report ( "Ruby: sequential" ) { 4 . times { tarai ( 14 , 7 , 0 ) } }
34
34
35
- # parallel version (with Ractor)
36
- x . report ( "parallel ( Ractor) " ) {
35
+ # Ruby: parallel version (with Ractor)
36
+ x . report ( "Ruby: Ractor" ) {
37
37
4 . times . map do
38
38
Ractor . new { tarai ( 14 , 7 , 0 ) }
39
39
end . each ( &:take )
40
40
}
41
41
42
- # parallel version (with Fiber)
43
- x . report ( "parallel ( Fiber) " ) {
42
+ # Ruby: parallel version (with Fiber)
43
+ x . report ( "Ruby: Fiber" ) {
44
44
4 . times . map do
45
45
Fiber . new { tarai ( 14 , 7 , 0 ) }
46
46
end . each ( &:resume )
47
47
}
48
48
49
- # parallel version (with goroutine)
50
- x . report ( "parallel ( goroutine) " ) { Example ::Benchmark . tarai_goroutine ( 14 , 7 , 0 , 4 ) }
49
+ # Go: parallel version (with goroutine)
50
+ x . report ( "Go: goroutine" ) { Example ::Benchmark . tarai_goroutine ( 14 , 7 , 0 , 4 ) }
51
51
52
52
x . compare!
53
53
end
0 commit comments