summaryrefslogtreecommitdiff
path: root/kernel.rb
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-08-30 13:04:11 +0200
committerJean Boussier <jean.boussier@gmail.com>2025-08-30 14:14:10 +0200
commitf5da6395bd3fdf4b76a480f174cd304823ddc57f (patch)
tree1e4bc98c7fbd4ee29e3f98e2009e23865f3a8432 /kernel.rb
parent01b89528cb663e1e533375d4282d906e49ca1496 (diff)
Kernel#class skip null check
`Kernel#class` can't possibly be called on an hidden object, hence we don't need to check for `klass == 0`. ``` compare-ruby: ruby 3.5.0dev (2025-08-30T01:45:42Z obj-class 01a57bd6cd) +YJIT +PRISM [arm64-darwin24] built-ruby: ruby 3.5.0dev (2025-08-30T10:21:10Z obj-class b67c16c477) +YJIT +PRISM [arm64-darwin24] | |compare-ruby|built-ruby| |:----------|-----------:|---------:| |obj | 445.217| 642.446| | | -| 1.44x| |extended | 136.826| 117.974| | | 1.16x| -| |singleton | 166.269| 166.695| | | -| 1.00x| |immediate | 380.243| 515.775| | | -| 1.36x| ```
Diffstat (limited to 'kernel.rb')
-rw-r--r--kernel.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel.rb b/kernel.rb
index 888ef0c531..5d596c8892 100644
--- a/kernel.rb
+++ b/kernel.rb
@@ -17,7 +17,7 @@ module Kernel
#
def class
Primitive.attr! :leaf
- Primitive.cexpr! 'rb_obj_class(self)'
+ Primitive.cexpr! 'rb_obj_class_must(self)'
end
#