Performance: Method calls are faster than Lambdas

Benchmark:

    require 'benchmark/ips'

    def convert_key(key)
      return key if key.is_a? String
      key.to_s.split('_')
         .map { |v| v.downcase == 'id' ? v.upcase : v.capitalize }
         .join
    end

    def lambda_convert_key
      lambda do |key|
        return key if key.is_a? String
        key.to_s.split('_')
           .map { |v| v.downcase == 'id' ? v.upcase : v.capitalize }
           .join
      end
    end

    Benchmark.ips do |x|
      x.report("Method Call") do
        convert_key(:member_id)
      end

      x.report("Lambda Call") do
        lambda_convert_key.call(:member_id)
      end
      x.compare!
    end

Result:

    $ ruby method_vs_lambda.rb
    Calculating -------------------------------------
       Method Call     27709 i/100ms
       Lambda Call     21850 i/100ms
    -------------------------------------------------
       Method Call   409434.0 (±7.6%) i/s -    2050466 in   5.044726s
       Lambda Call   275376.1 (±7.2%) i/s -    1376550 in   5.032176s

    Comparison:
       Method Call:   409434.0 i/s
       Lambda Call:   275376.1 i/s - 1.49x slower