Project

General

Profile

Actions

Feature #15721

open

optimize comparison of special const

Added by masarakki (masaki yamada) almost 5 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:91921]

Description

Description

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

Benchmark

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) optimize-comparable-condition.patch masarakki (masaki yamada), 03/22/2019 06:24 AM

No data to display

Actions

Also available in: Atom PDF

Like0