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

Speed up the per-iteration time for longer benchmarks #336

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion benchmarks/30k_ifelse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240012,7 +240012,7 @@ def inc(x)

require_relative '../harness/loader'

INTERNAL_ITRS = Integer(ENV.fetch("INTERNAL_ITRS", 600))
INTERNAL_ITRS = Integer(ENV.fetch("INTERNAL_ITRS", 200))

run_benchmark(30) do
INTERNAL_ITRS.times do
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/30k_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120009,7 +120009,7 @@ def inc()

require_relative '../harness/loader'

INTERNAL_ITRS = Integer(ENV.fetch("INTERNAL_ITRS", 2000))
INTERNAL_ITRS = Integer(ENV.fetch("INTERNAL_ITRS", 200))

run_benchmark(10) do
INTERNAL_ITRS.times do
Expand Down
1 change: 0 additions & 1 deletion benchmarks/blurhash/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def self.multiplyBasisFunction(xComponent, yComponent, width, height, rgb, bytes
factors.set(yComponent, xComponent, 2, b * scale)
end


def self.encode_int(value, length, destination)
divisor = 83 ** (length - 1)

Expand Down
14 changes: 6 additions & 8 deletions benchmarks/fannkuchredux/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ def fannkuch(n)
require_relative '../../harness/loader'

run_benchmark(10) do
5.times do
sum, flips = fannkuch(n)
sum, flips = fannkuch(n)

if sum != 8629
raise RuntimeError, "incorrect sum: #{sum}"
end
if sum != 8629
raise RuntimeError, "incorrect sum: #{sum}"
end

if flips != 30
raise RuntimeError, "incorrect flips: #{flips}"
end
if flips != 30
raise RuntimeError, "incorrect flips: #{flips}"
end
end
2 changes: 1 addition & 1 deletion benchmarks/fluentd/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"No local datasource found",
]
ltsv = 1000.times.map { |i| "time:#{time + i} module:main.py level:DEBUG message:#{errors.sample}\n" }.join
ltsv *= 1000
ltsv *= 250

# Prepare an LTSV parser
parser = Fluent::Plugin::LabeledTSVParser.new
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/graphql/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

require "graphql"

file = File.read "negotiate.gql"
data = File.read "negotiate.gql"

run_benchmark(10) do
100.times do |i|
GraphQL.parse file
10.times do |i|
GraphQL.parse data
end
end
2 changes: 1 addition & 1 deletion benchmarks/matmul.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def matmul(a, b)
c
end

n = 300
n = 200
if ARGV.length > 0
n = ARGV[0].to_i
end
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/ruby-json/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@ def parse_item
# https://github.com/openfootball/football.json/blob/master/2011-12/at.1.json
source = IO.read("#{__dir__}/data.json")

run_benchmark(10) { 1000.times { JSONParser.new(source).parse } }
run_benchmark(10) { 100.times { JSONParser.new(source).parse } }
2 changes: 1 addition & 1 deletion benchmarks/ruby-xor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def ruby_xor!(a, b)
b = 'this is also a long string with no useful contents yada yada daaaaaa'

run_benchmark(20) do
for i in 0...100_000
for i in 0...20_000
ruby_xor!(a.dup, b)
end
end
Expand Down
15 changes: 3 additions & 12 deletions benchmarks/sudoku.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,9 @@ def sd_solve(mr, mc, s)

mr, mc = sd_genmat

n = 4
if ARGV.length > 0
n = ARGV[0].to_i
end

run_benchmark(20) do
i = 0
while i < n
hard20.each do |line|
sd_solve(mr, mc, line)
# puts ""
end
i += 1
hard20.each do |line|
sd_solve(mr, mc, line)
# puts ""
end
end
Loading