Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 harness/harness-common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def return_results(warmup_iterations, bench_iterations)
if yjit_stats
yjit_bench_results["yjit_stats"] = yjit_stats

formatted_stats = proc { |key| "%10s" % yjit_stats[key].to_s.reverse.scan(/\d{1,3}/).join(",").reverse }
formatted_stats = proc { |key| "%10s" % yjit_stats[key].to_s.split(".").tap { |a| a[0] = a[0].reverse.scan(/\d{1,3}/).join(",").reverse }.join(".") }
yjit_stats_keys = [
*ENV.fetch("YJIT_BENCH_STATS", "").split(",").map(&:to_sym),
:inline_code_size,
Expand Down
11 changes: 10 additions & 1 deletion harness/harness.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,16 @@ def run_benchmark(_num_itrs_hint, &block)

yjit_stats&.each do |key, old_value|
new_value = RubyVM::YJIT.runtime_stats(key)
diff = (new_value - old_value).to_s.reverse.scan(/\d{1,3}/).join(",").reverse

# Insert comma separators but only in the whole number portion.
diff = (new_value - old_value).to_s.split(".").tap do |a|
# Preserve any leading minus sign that may be on the beginning.
a[0] = a[0].reverse.scan(/\d{1,3}-?/).join(",").reverse
# Add a space when positive so that if there is ever a negative
# the first digit will line up.
a[0].prepend(" ") unless a[0].start_with?("-")
end.join(".")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be code to put this in a utility function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I hesitated because we've talked before about how additional definitions in the global env can have an affect on the benchmark, but it would allow us to reuse it in the other location


itr_str << " %#{key.size}s" % diff
yjit_stats[key] = new_value
end
Expand Down
Loading