You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some reports, a control report would be nice to be able to separate out expensive, shared behavior.
For example, the 'dup' report in this benchmark:
report = Benchmark.bigo do |x|
x.generator {|size|
(0...size).each_with_object({}) do |i, h|
h[i] = SecureRandom.hex
end
}
# dup acts as a control for this test
# because merge! modifies the existing hash,
# the hash needs to be duped in order to test
# appropriately
#
# this means that to control for this work in the
# other reports, the hash must also be duped, even
# for merge where the original hash is not modified
x.report("dup") { |items, size|
items.dup
}
x.report("merge") { |items, size|
items.dup.merge(rand(size) => SecureRandom.hex)
}
x.report("merge!") { |items, size|
items.dup.merge!(rand(size) => SecureRandom.hex)
}
x.report("set") { |items, size|
items.dup[rand(size)] = SecureRandom.hex
}
end
In this case, if the expense of the 'dup' report were then subtracted from the results of the other reports, a cleaner view of the differences in behavior would be possible.
The text was updated successfully, but these errors were encountered:
For some reports, a control report would be nice to be able to separate out expensive, shared behavior.
For example, the 'dup' report in this benchmark:
In this case, if the expense of the 'dup' report were then subtracted from the results of the other reports, a cleaner view of the differences in behavior would be possible.
The text was updated successfully, but these errors were encountered: