Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 206ed769dbc0
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d63ccf5e4d47
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jun 25, 2015

  1. Use BasicObject#equal? for Symbol#==.

    Significantly faster for the case of different symbols:
    
    require 'benchmark/ips'
    Benchmark.ips do |b|
      b.report("Symbol#==") do
        :a == :b
      end
    end
    
    Before:
    Symbol#==      2.712M (± 3.4%) i/s -     13.589M
    After
    Symbol#==      6.862M (± 2.6%) i/s -     34.413M
    eregon committed Jun 25, 2015
    Copy the full SHA
    058b897 View commit details
  2. Merge pull request #3449 from eregon/symbol_equal

    Use BasicObject#equal? for Symbol#==.
    Yorick Peterse committed Jun 25, 2015
    Copy the full SHA
    d63ccf5 View commit details
Showing with 3 additions and 0 deletions.
  1. +3 −0 kernel/common/symbol.rb
3 changes: 3 additions & 0 deletions kernel/common/symbol.rb
Original file line number Diff line number Diff line change
@@ -7,6 +7,9 @@ def <=>(other)
to_s <=> other.to_s
end

# Use equal? for == (and not Comparable version)
alias_method :==, :equal?

def capitalize
to_s.capitalize.to_sym
end