FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
fast-ruby/code/general/block-apply-method.rb at main · fastruby/fast-ruby · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
fastruby
/
fast-ruby
Public
Notifications
You must be signed in to change notification settings
Fork
371
Star
5.7k
Code
Issues
30
Pull requests
16
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
fast-ruby
/
code
/
general
/
block-apply-method.rb
Copy path
More file actions
More file actions
Latest commit
History
History
History
19 lines (15 loc) · 268 Bytes
Breadcrumbs
fast-ruby
/
code
/
general
/
block-apply-method.rb
Copy path
File metadata and controls
19 lines (15 loc) · 268 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require
"benchmark/ips"
def
do_something
(
n
)
4
*
n
+
2
end
def
fast
[
1
,
2
,
3
]
.
map
{
|
n
|
do_something
(
n
)
}
end
def
slow
[
1
,
2
,
3
]
.
map
(
&
method
(
:do_something
)
)
end
Benchmark
.
ips
do
|
x
|
x
.
report
(
"normal"
)
{
fast
}
x
.
report
(
"&method"
)
{
slow
}
x
.
compare!
end
Back
|
FazBrowse Home
|
New Git URL