Project

General

Profile

ActionsLike0

Feature #15721

open

optimize comparison of special const

Added by masarakki (masaki yamada) almost 6 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

ActionsLike0

Also available in: Atom PDF