diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2023-01-11 09:23:03 -0500 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2023-01-11 11:06:58 -0500 |
| commit | abff5f62037284024aaf469fc46a6e8de98fa1e3 (patch) | |
| tree | 47347d74b361020233615449e9c508b82afaccdc /test/ruby | |
| parent | d86833e717104b477c32e135a15fcbf380c6abb2 (diff) | |
Move classpath to rb_classext_t
This commit moves the classpath (and tmp_classpath) from instance
variables to the rb_classext_t. This improves performance as we no
longer need to set an instance variable when assigning a classpath to
a class.
I benchmarked with the following script:
```ruby
name = :MyClass
puts(Benchmark.measure do
10_000_000.times do |i|
Object.const_set(name, Class.new)
Object.send(:remove_const, name)
end
end)
```
Before this patch:
```
5.440119 0.025264 5.465383 ( 5.467105)
```
After this patch:
```
4.889646 0.028325 4.917971 ( 4.942678)
```
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7096
Diffstat (limited to 'test/ruby')
0 files changed, 0 insertions, 0 deletions
