You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Effectively for every filter (which is a tuple of OS and release) it does a call to FacterDB to get facts. If there is not an exact match for the requested Facter version it does another. Then once is has collected all this information, it does one last call to FacterDB to get all the data. Note that this last call is effectively redundant because for every iteration the facts for that filter were already retrieved.
This gives us a worst case complexity of 2n+1 where n is the number of supported OS releases.
The most obvious workaround is to record new facts for every facter release. This would reduce it down to n+1 complexity. However, that means the FacterDB itself will grow which may result in other scaling problems.
Perhaps FacterDB could expose a richer API to allow more effective queries. For example, a lambda to filter a fact. This is not supported by jgrep, but something to think about.
Another consideration is to just query without a facterversion filter and then filter out any unwanted results. Then concat those results.
The text was updated successfully, but these errors were encountered:
While #122 greatly reduces the expensive calls to
on_supported_os
, there are still a lot of calls to FacterDB. Some hot code is here:https://github.com/mcanevet/rspec-puppet-facts/blob/c2987a1b6cd7a9ab104aed8aa7ff61e28ce29cce/lib/rspec-puppet-facts.rb#L115-L141
Effectively for every filter (which is a tuple of OS and release) it does a call to FacterDB to get facts. If there is not an exact match for the requested Facter version it does another. Then once is has collected all this information, it does one last call to FacterDB to get all the data. Note that this last call is effectively redundant because for every iteration the facts for that filter were already retrieved.
This gives us a worst case complexity of
2n+1
where n is the number of supported OS releases.The most obvious workaround is to record new facts for every facter release. This would reduce it down to
n+1
complexity. However, that means the FacterDB itself will grow which may result in other scaling problems.Perhaps FacterDB could expose a richer API to allow more effective queries. For example, a lambda to filter a fact. This is not supported by jgrep, but something to think about.
Another consideration is to just query without a facterversion filter and then filter out any unwanted results. Then concat those results.
The text was updated successfully, but these errors were encountered: