⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (389 Bytes)
Feature #6183
» bench.rb
benchmark used for measuring -
gregolsen (Innokenty Mikhailov)
, 04/03/2012 05:43 PM
require
'benchmark'
def
make_test
len
arr
=
[
1
]
*
len
n
=
1000
Benchmark
.
bm
(
15
)
do
|
r
|
l
=
r
.
report
(
'Lazy enumerator'
)
do
n
.
times
{
arr
.
lazy
.
map
{
|
x
|
x
*
9
}.
map
{
|
x
|
x
*
55
}.
each
{
|
x
|
x
*
100
}
}
end
s
=
r
.
report
(
'Simple array'
)
do
n
.
times
{
arr
.
map
{
|
x
|
x
*
9
}.
map
{
|
x
|
x
*
55
}.
each
{
|
x
|
x
*
100
}
}
end
[
s
/
l
]
end
end
make_test
(
1000
)
« Previous
1
2
3
4
…
6
Next »
(2-2/6)
Loading...