Batch loop and push down conditions in the conan presenter
From !76767 (comment 796568051):
As far as I see it, no. We will load all the package files.
Looking at the parts of the presenter that uses
#package_files
, we might be able to "push down" additional conditions.Basically, what happens is that we need to loop through package files with different conditions:
- for recipe files (that's one "kind" of package file in the conan package format)
- for matching a conan reference
The current implementation loads and memoize all the package files first. Then each conditions (1.) and (2.) are applied during the loop.
Perhaps we could split this in two queries so that we can implement conditions (1.) and (2.) at the SQL level = less objects retrieved. Also, it might be more efficient to implement conditions on the database side than having ruby conditions in the loop (even if that means having 2 queries instead of 1).
Additionally, we can implement batch looping for those package files. This will prevent loading all package files in memory (We currently have a
package_files.to_a.map
on L69,😿 ).