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
This change introduces a new comparison ordering strategy where the
initial report serves as the baseline against which the job compares the
other reports.
This is useful in cases where you're testing out different
implementations and want to see whether they are better or worse (and
the comparative increase or decrease) in an easy-to-decipher order.
-[#28](https://github.com/michaelherold/benchmark-memory/pull/28): Add the `order: :baseline` comparison method to compare results against a baseline report - [@michaelherold](https://github.com/michaelherold).
Copy file name to clipboardExpand all lines: README.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,6 +113,21 @@ end
113
113
114
114
When you're looking for a memory leak, this configuration can help you because it compares your reports by the amount of memory that the garbage collector does not collect after the benchmark.
115
115
116
+
#### Ordering by a baseline
117
+
118
+
When you're looking to see whether you can improve memory performance by refactoring some code, it can help to visually compare your reports against a baseline. To do so, place your baseline report first and enable the `order: :baseline` option like so:
119
+
120
+
```ruby
121
+
Benchmark.memory do |bench|
122
+
bench.report("my baseline") {}
123
+
bench.report("another test") {}
124
+
125
+
bench.compare! order::baseline
126
+
end
127
+
```
128
+
129
+
This will always show the baseline at the top of the comparison and order the alternatives in ascending order against the baseline.
0 commit comments