Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code template in README.md #140

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ require 'benchmark/ips'
Benchmark.ips do |x|
# Configure the number of seconds used during
# the warmup phase (default 2) and calculation phase (default 5)
x.config(:time => 5, :warmup => 2)

# These parameters can also be configured this way
nateberkopec marked this conversation as resolved.
Show resolved Hide resolved
x.time = 5
x.warmup = 2
x.config(warmup: 2, time: 5)
nateberkopec marked this conversation as resolved.
Show resolved Hide resolved

# Typical mode, runs the block as many times as it can
x.report("addition") { 1 + 2 }
Expand All @@ -43,8 +39,9 @@ Benchmark.ips do |x|
x.report("addition2") do |times|
i = 0
while i < times
1 + 2
i += 1

1 + 2
end
end

Expand Down