Skip to content

Instantly share code, notes, and snippets.

@labocho
Last active March 26, 2020 08:55
Show Gist options
  • Save labocho/23f8e089205a507e6089ce1e8ce5a863 to your computer and use it in GitHub Desktop.
Save labocho/23f8e089205a507e6089ce1e8ce5a863 to your computer and use it in GitHub Desktop.
Benchmark of itamae file resource optimization
require "benchmark"
Benchmark.bm do |x|
x.report {
5.times do |i|
system("bundle exec itamae ssh --host=192.168.33.10 --user=itamae file_creation.rb", out: "/dev/null", err: "/dev/null") || raise
end
}
end
# optimize-file-resource branch (c2611e596b3d129c7cbc7b3e44c557620b0b3dff)
# user system total real
# 0.000760 0.004474 6.790054 ( 43.213244)
# master branch (fdcc629f5288910dea558143b415c26bd3b73856)
# user system total real
# 0.000695 0.004052 9.706326 ( 65.963517)
# (1 - (43.213244 / 65.963517)) * 100 => 34.5% fast
10.times do |n|
file "/tmp/#{n}" do
content n.to_s
mode "644"
owner "itamae"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment