Skip to content

Commit cd1365d

Browse files
committed
Allow multiple benchmarks per folder in ruby-bench
1 parent 7db4e0b commit cd1365d

File tree

34 files changed

+804
-255
lines changed

34 files changed

+804
-255
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,33 @@ It's also convenient for profiling, debugging, etc, especially since all benchma
101101
ruby benchmarks/some_benchmark.rb
102102
```
103103

104+
### Benchmark organization
105+
106+
Benchmarks can be organized in three ways:
107+
108+
1. **Standalone .rb files** - Place a `.rb` file directly in the `benchmarks/` directory:
109+
```
110+
benchmarks/fib.rb # Benchmark name: "fib"
111+
```
112+
113+
2. **Single benchmark per directory** - For benchmarks that need additional files (like Gemfiles):
114+
```
115+
benchmarks/erubi/
116+
benchmark.rb # Benchmark name: "erubi"
117+
Gemfile
118+
```
119+
120+
3. **Multiple benchmarks per directory** - For related benchmarks sharing dependencies:
121+
```
122+
benchmarks/addressable/
123+
equality.rb # Benchmark name: "addressable-equality"
124+
join.rb # Benchmark name: "addressable-join"
125+
Gemfile # Shared Gemfile
126+
```
127+
128+
In directories **without** a `benchmark.rb` file, all `.rb` files will be discovered as separate benchmarks.
129+
The benchmark name is derived as `directoryname-suffix` from `suffix.rb` files.
130+
104131
## Ractor Benchmarks
105132

106133
ruby-bench supports Ractor-specific benchmarking with dedicated categories and benchmark directories.

benchmarks/addressable-getters/Gemfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

benchmarks/addressable-getters/Gemfile.lock

Lines changed: 0 additions & 16 deletions
This file was deleted.

benchmarks/addressable-join/Gemfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

benchmarks/addressable-join/Gemfile.lock

Lines changed: 0 additions & 16 deletions
This file was deleted.

benchmarks/addressable-merge/Gemfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

benchmarks/addressable-merge/Gemfile.lock

Lines changed: 0 additions & 16 deletions
This file was deleted.

benchmarks/addressable-new/Gemfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

benchmarks/addressable-new/Gemfile.lock

Lines changed: 0 additions & 16 deletions
This file was deleted.

benchmarks/addressable-normalize/Gemfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)