jekyll / jekyll-redirect-from

:twisted_rightwards_arrows: Seamlessly specify multiple redirections URLs for your pages and posts.
MIT License
780 stars 112 forks source link

Use `Hash#key?` instead of `Hash#keys.any?` #201

Closed ashmaroli closed 5 years ago

ashmaroli commented 5 years ago

Hash#key? is a lot faster than Hash#keys.any?

Warming up --------------------------------------
           keys.any?    38.835k i/100ms
                key?    93.048k i/100ms
Calculating -------------------------------------
           keys.any?    573.498k (A± 1.3%) i/s -      2.874M in   5.011842s
                key?      2.883M (A± 1.7%) i/s -     14.422M in   5.003596s

Comparison:
                key?:  2883339.1 i/s
           keys.any?:   573498.4 i/s - 5.03x  slower
ashmaroli commented 5 years ago

@jekyllbot: merge +fix