diff options
| author | nagachika <nagachika@ruby-lang.org> | 2024-07-20 13:11:29 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2024-07-20 13:11:29 +0900 |
| commit | 4f1e047f86b159528055d37ee0da2ad6e5a38c23 (patch) | |
| tree | 355be245422353246c971f877dc68f2a3d101b09 /spec/ruby/core/kernel | |
| parent | 3fe51aa26867159af574fac8eba7ae86a0b30971 (diff) | |
merge revision(s) a3eb5e5c70eaee12964cdd807b8f19950003141f: [Backport #20573]
Don't call `Warning.warn` unless the category is enabled (#10981)
Don't call `Warning.warn` unless the category is enabled
The warning category should be enabled if we want to call
`Warning.warn`.
This commit speeds up the following benchmark:
```ruby
eval "def test; " +
1000.times.map { "' '.chomp!" }.join(";") + "; end"
def run_benchmark count
i = 0
while i < count
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
yield
ms = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
puts "itr ##{i}: #{(ms * 1000).to_i}ms"
i += 1
end
end
run_benchmark(25) do
250.times do
test
end
end
```
On `master` this runs at about 92ms per iteration. With this patch, it
is 7ms per iteration.
[Bug #20573]
Diffstat (limited to 'spec/ruby/core/kernel')
0 files changed, 0 insertions, 0 deletions
