sarugaku / resolvelib

Resolve abstract dependencies into concrete ones
ISC License
138 stars 31 forks source link

Implement lazy consumption of the candidates iterable returned by find_matches() #106

Closed frostming closed 2 years ago

frostming commented 2 years ago

This will help improve the performance by not requesting the network with certain provider implementations. For example, a provider will first find matches from local files and then from the remote server, all candidates are combined into a generator returned by find_matches(). So if the local candidates meet the requirement, we don't need to read the whole iterable.

File this issue just as an improvement idea. I will do some experiment to find out a solution for it.

frostming commented 2 years ago

OK I find _FactoryIterableView that stores a generator function to produce iterators that can be iterated through for many times.