So I did a profiling on calling `Facter.value(:kernel)` on Facter 4 and Facter 2 and Facter 4 is noticeably slower(0.13s vs 0.01s). From the call tree seems that the execution API is slower in Facter 4. Attached are the traces for each call: facter2.html - trace for calling `Facter.value(:kernel) with facter 2 Thread: 1580, Fiber: 1560 (100.00% ~ 0.010857273999135941) facter4.html - trace for calling `Facter.value(:kernel) with facter 4 Thread: 2160, Fiber: 2140 (37.49% ~ 0.13846525101689622) Thread: 2200, Fiber: 2180 (20.90% ~ 0.13846525101689622) Thread: 2240, Fiber: 2220 (20.83% ~ 0.13846525101689622) Thread: 2280, Fiber: 2260 (20.78% ~ 0.13846525101689622) facter4_patched.html - trace for calling `Facter.value(:kernel) with facter 4 without hitting the resolver. Monkey patching the BaseResolver class Thread: 2160, Fiber: 2140 (100.00% ~ 0.01828752097208053)
if defined? Facter::Resolvers::BaseResolver |
Facter::Resolvers::BaseResolver.class_eval do |
def self.resolve(_fact_name, _options = {}); end |
end |
end
|
Having rspec-puppet to monkey patch Facter 4(https://github.com/gimmyxd/rspec-puppet/commit/49a0c2128ff079a97d2322446098f09cdf6185b1), does not seem to improve the full test suite speed when running on gh actions. Locally I managed to get an improvement of around 20% when running a single test file from puppet-nginx module, for a single OS |