1. 16 6月, 2014 1 次提交
    • M
      Change Http::Cache::SPECIAL_KEYS from Array to Set · e3123815
      Mindaugas Mozūras 提交于
      Slightly improves performance, for example, a simple benchmark:
      
      ```ruby
      require 'benchmark/ips'
      require 'set'
      
      SPECIAL_KEYS = %w[extras no-cache max-age public must-revalidate]
      SPECIAL_KEYS_SET = Set.new(SPECIAL_KEYS)
      directive = 'must-revalidate'
      
      Benchmark.ips do |x|
        x.report('array') { SPECIAL_KEYS.include?(directive) }
        x.report('set') { SPECIAL_KEYS_SET.include?(directive) }
      end
      ```
      
      Output:
      
      ```
      -------------------------------------
         array     67926 i/100ms
           set     74054 i/100ms
      -------------------------------------
         array  2318423.4 (±2.8%) i/s -   11615346 in   5.014899s
           set  3387981.8 (±4.7%) i/s -   16958366 in   5.019355s
      ```
      e3123815
  2. 15 6月, 2014 14 次提交
  3. 14 6月, 2014 25 次提交