Optimize map { ... }.compact calls (#15513)
* Optimize map { ... }.compact using Enumerable#filter_map, supported since Ruby 2.7 * Add poyfill for Enumerable#filter_map
This commit is contained in:
parent
9395143126
commit
087ed84367
22 changed files with 52 additions and 26 deletions
|
@ -45,7 +45,7 @@ module CacheConcern
|
|||
end
|
||||
end
|
||||
|
||||
raw.map { |item| cached_keys_with_value[item.id] || uncached[item.id] }.compact
|
||||
raw.filter_map { |item| cached_keys_with_value[item.id] || uncached[item.id] }
|
||||
end
|
||||
|
||||
def cache_collection_paginated_by_id(raw, klass, limit, options)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue