mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Lazily create objspace->id_to_obj_tbl
This inverse table is only useful if `ObjectSpace._id2ref` is used,
which is extremely rare. The only notable exception is the `drb` gem
and even then it has an option not to rely on `_id2ref`.
So if we assume this table will never be looked up, we can just
not maintain it, and if it turns out `_id2ref` is called, we
can lock the VM and re-build it.
```
compare-ruby: ruby 3.5.0dev (2025-04-10T09:44:40Z master 684cfa42d7
) +YJIT +PRISM [arm64-darwin24]
built-ruby: ruby 3.5.0dev (2025-04-10T10:13:43Z lazy-id-to-obj d3aa9626cc) +YJIT +PRISM [arm64-darwin24]
warming up..
| |compare-ruby|built-ruby|
|:----------|-----------:|---------:|
|baseline | 26.364M| 25.974M|
| | 1.01x| -|
|object_id | 10.293M| 14.202M|
| | -| 1.38x|
```
This commit is contained in:
parent
b68172caad
commit
0606046c1a
Notes:
git
2025-04-15 00:18:12 +00:00
5 changed files with 74 additions and 20 deletions
4
benchmark/object_id.yml
Normal file
4
benchmark/object_id.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
benchmark:
|
||||
baseline: "Object.new"
|
||||
object_id: "Object.new.object_id"
|
||||
# loop_count: 100000
|
Loading…
Add table
Add a link
Reference in a new issue