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
Name each benchmark's winner and lint it #243 named every report by rank. The recommended side uses fast, then faster, then fastest. The other side uses slow, then slower, then slowest. The winner is listed first. Names like slow1, slow_1 to slow_5, key_fast and with_feeze are gone, including every file listed in Refactoring code #169 (comment).
@dukaev proposed this first in #170, putting the fast code first in 21 files. #243 finishes that idea.
The repo now has a linter that enforces the template, so new benchmarks can't drift from it. It fails CI when a Benchmark.ips block doesn't call x.compare!, sets its own timing, never runs, or doesn't put exactly one fastest/faster/fast report first:
The names grow outward from the line between fast and slow: the recommended side uses `fast`, then `faster`, then `fastest`; the other side uses `slow`, then `slower`, then `slowest`.
The names are relative: `slow` only means slower than `fast`.
When a ranking could look odd, say why in one line, like in `code/array/length-vs-size-vs-count.rb`:
Activity
ashwinisukale commentedon Oct 11, 2022
I found following code examples where we are not following the template
https://github.com/fastruby/fast-ruby/blob/main/code/enumerable/sort-vs-sort_by.rb - Here instead of faster and fastest, can we say fast and faster
https://github.com/fastruby/fast-ruby/blob/main/code/hash/keys-include-vs-key.rb - Can we change method name to slow and faster, as we are following same template for all our examples
https://github.com/fastruby/fast-ruby/blob/main/code/hash/values-include-vs-value.rb - Can we change method name to slow and faster, as we are following same template for all our examples
https://github.com/fastruby/fast-ruby/blob/main/code/method/call-vs-send-vs-method_missing.rb - Instead of fastest, rename to fast
https://github.com/fastruby/fast-ruby/blob/main/code/proc-and-block/proc-call-vs-yield.rb - can we rename slow1, slow2 etc to what actually that method is doing
https://github.com/fastruby/fast-ruby/blob/main/code/string/mutable_vs_immutable_strings.rb - specify which is slower and faster, as per the template we follow in all examples
https://github.com/fastruby/fast-ruby/blob/main/code/string/sub!-vs-gsub!-vs-%5B%5D%3D.rb - Can we change name from
slow_1to what method is egslow_subJuanVqz commentedon Sep 29, 2026
I noticed this too and worked on it, so that one glance at a file under
code/tells you which code isfastand which isslow.x.compare!at the end, and aBenchmark.ipsthat actually runs.fast, thenfaster, thenfastest. The other side usesslow, thenslower, thenslowest. The winner is listed first. Names likeslow1,slow_1toslow_5,key_fastandwith_feezeare gone, including every file listed in Refactoring code #169 (comment).@dukaev proposed this first in #170, putting the fast code first in 21 files. #243 finishes that idea.
The repo now has a linter that enforces the template, so new benchmarks can't drift from it. It fails CI when a
Benchmark.ipsblock doesn't callx.compare!, sets its own timing, never runs, or doesn't put exactly onefastest/faster/fastreport first:fast-ruby/.github/scripts/lint-benchmarks.rb
Lines 1 to 12 in 86836b0
fast-ruby/.github/workflows/benchmarks.yml
Lines 27 to 35 in 86836b0
main: https://github.com/fastruby/fast-ruby/actions/runs/36504571544/job/109202974677fast-ruby/CONTRIBUTING.md
Lines 47 to 50 in 86836b0
Closing this one. Thanks for raising it!