diff options
| author | Aaron Patterson <tenderlove@ruby-lang.org> | 2024-06-10 16:05:03 -0700 |
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2024-06-11 14:54:15 -0700 |
| commit | 1271ff72d5b627854c6812baefe796a2976cd793 (patch) | |
| tree | 1884040dcae54c82f72a8b4141c50b781bdc1854 /test/ruby/test_encoding.rb | |
| parent | 0a6b1a4d9de583ebfd305ab1b297be1cea7bdc2f (diff) | |
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 'test/ruby/test_encoding.rb')
0 files changed, 0 insertions, 0 deletions
