Issue #15721 has been reported by masarakki (masaki yamada).

----------------------------------------
Feature #15721: optimize comparison of special const
https://bugs.ruby-lang.org/issues/15721

* Author: masarakki (masaki yamada)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
## Description

optimize comparison between special consts in `comparable_by_identity`.
it is called from `==` .



## Benchmark


```ruby
num_array = Array.new(1_000_000) { 1 }

num_array.include? nil 
 # 0.156 => 0.0089      # 20x faster!
num_array.include? :symbol 
 # 0.157 => 0.0086    # 20x faster!
num_array.include? 'str'
 # 0.185 => 0.183     # not faster because 'str' is not a special const
```



---Files--------------------------------
optimize-comparable-condition.patch (1.49 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>