1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Reduce memory allocations

Group sequential maps and remove unnecessary `to_a` in range
This commit is contained in:
Matheus Richard 2021-02-04 13:40:33 -03:00
parent 5a477890c8
commit 4ea64630aa

View file

@ -35,7 +35,7 @@ module ActionDispatch
US_ASCII = Encoding::US_ASCII
UTF_8 = Encoding::UTF_8
EMPTY = (+"").force_encoding(US_ASCII).freeze
DEC2HEX = (0..255).to_a.map { |i| ENCODE % i }.map { |s| s.force_encoding(US_ASCII) }
DEC2HEX = (0..255).map { |i| (ENCODE % i).force_encoding(US_ASCII) }.freeze
ALPHA = "a-zA-Z"
DIGIT = "0-9"