Skip to content

Instantly share code, notes, and snippets.

@danielsdeleo
Created September 30, 2009 03:45
Show Gist options
  • Select an option

  • Save danielsdeleo/197746 to your computer and use it in GitHub Desktop.

Select an option

Save danielsdeleo/197746 to your computer and use it in GitHub Desktop.
require "rubygems"
require "chef"
require "benchmark"
Chef::Config.cookbook_path = ["/tmp/slowmoin/chef-repo/cookbooks/"]
Chef::CookbookLoader.new
# TESTS = 10
# Benchmark.bmbm do |results|
# results.report("cl:") { TESTS.times { Chef::CookbookLoader.new } }
# end
__END__
## GREAT SUCCESS ##
# THEN:
eigenstate$ ruby cltest.rb
user system total real
cl: 65.910000 4.940000 70.850000 ( 71.823381)
# AND NOW:
eigenstate$ ruby cltest.rb
user system total real
cl: 0.220000 0.190000 0.410000 ( 0.412658)
http://github.com/opscode/chef/commit/a76f0d5ca115d4ea7a51b21b8dc0ead4ed91f4eb
http://github.com/opscode/chef/commit/1dcd2b85450e1df9a912fe934aa9bc9e62d7f778
ruby ./cltest.rb
% cumulative self self total
time seconds seconds calls ms/call ms/call name
96.61 17.67 17.67 3782 4.67 18.76 Array#each
0.60 17.78 0.11 1635 0.07 0.08 Chef::CookbookLoader#skip_file
0.49 17.87 0.09 1635 0.06 10.59 Enumerable.detect
0.33 17.93 0.06 32 1.88 12.19 Hash#each_key
0.22 17.97 0.04 76 0.53 0.53 Module#==
0.22 18.01 0.04 1027 0.04 18.19 Class#new
0.22 18.05 0.04 124 0.32 1.21 Chef::Mixin::ParamsValidate.validate
0.16 18.08 0.03 76 0.39 1.05 Chef::Cookbook::Metadata#provides
0.16 18.11 0.03 124 0.24 143.47 Chef::CookbookLoader#load_cascading_files
0.11 18.13 0.02 279 0.07 0.11 Mash#initialize
0.11 18.15 0.02 124 0.16 0.73 Kernel.send
0.11 18.17 0.02 124 0.16 0.40 Chef::CookbookLoader#load_files_unless_basename
0.05 18.18 0.01 184 0.05 0.05 String#to_sym
0.05 18.19 0.01 124 0.08 0.08 Chef::Mixin::ParamsValidate._pv_opts_lookup
0.05 18.20 0.01 924 0.01 0.01 String#==
0.05 18.21 0.01 124 0.08 0.56 Chef::Mixin::ParamsValidate._pv_kind_of
0.05 18.22 0.01 1 10.00 10.00 Array#include?
0.05 18.23 0.01 1701 0.01 0.01 Array#<<
0.05 18.24 0.01 152 0.07 1.12 Chef::Mixin::ParamsValidate.set_or_return
0.05 18.25 0.01 248 0.04 0.04 Kernel.===
0.05 18.26 0.01 76 0.13 0.66 Mash#convert_value
0.05 18.27 0.01 313 0.03 0.03 Hash#initialize
0.05 18.28 0.01 31 0.32 10.32 Chef::Cookbook::Metadata#initialize
0.05 18.29 0.01 248 0.04 0.85 Hash#each
0.00 18.29 0.00 32 0.00 0.00 File#directory?
0.00 18.29 0.00 31 0.00 0.00 Chef::CookbookLoader#load_ignore_file
0.00 18.29 0.00 1 0.00 18280.00 Chef::CookbookLoader#load_cookbooks
0.00 18.29 0.00 28 0.00 0.00 Mash#default
0.00 18.29 0.00 104 0.00 0.00 Mash#convert_key
0.00 18.29 0.00 533 0.00 0.00 Symbol#to_s
0.00 18.29 0.00 276 0.00 0.00 Kernel.==
0.00 18.29 0.00 279 0.00 0.00 Hash#has_key?
0.00 18.29 0.00 1 0.00 0.00 Array#-
0.00 18.29 0.00 31 0.00 3.23 Enumerable.inject
0.00 18.29 0.00 31 0.00 0.00 Chef::Cookbook::Metadata::Version#initialize
0.00 18.29 0.00 1 0.00 0.00 Symbol#id2name
0.00 18.29 0.00 31 0.00 0.32 Chef::Cookbook#initialize
0.00 18.29 0.00 124 0.00 0.00 Kernel.respond_to?
0.00 18.29 0.00 248 0.00 0.00 Symbol#to_sym
0.00 18.29 0.00 124 0.00 0.00 Module#===
0.00 18.29 0.00 435 0.00 0.00 File#join
0.00 18.29 0.00 620 0.00 0.00 Array#initialize
0.00 18.29 0.00 31 0.00 0.32 Chef::Cookbook::Metadata#maintainer_email
0.00 18.29 0.00 76 0.00 0.00 Kernel.class
0.00 18.29 0.00 1 0.00 10.00 Mixlib::Config.internal_set
0.00 18.29 0.00 124 0.00 0.00 Dir#glob
0.00 18.29 0.00 600 0.00 0.00 Kernel.kind_of?
0.00 18.29 0.00 77 0.00 0.00 Array#[]
0.00 18.29 0.00 279 0.00 0.00 Hash#each_pair
0.00 18.29 0.00 2 0.00 0.00 Fixnum#>
0.00 18.29 0.00 383 0.00 0.00 Kernel.is_a?
0.00 18.29 0.00 1 0.00 18280.00 Chef::CookbookLoader#initialize
0.00 18.29 0.00 28 0.00 0.00 Mash#include?
0.00 18.29 0.00 2 0.00 5.00 Mixlib::Config.method_missing
0.00 18.29 0.00 28 0.00 0.00 Kernel.instance_variable_get
0.00 18.29 0.00 31 0.00 0.00 Array#concat
0.00 18.29 0.00 124 0.00 0.00 Kernel.instance_variable_set
0.00 18.29 0.00 107 0.00 0.00 Regexp#===
0.00 18.29 0.00 93 0.00 0.00 String#to_i
0.00 18.29 0.00 31 0.00 0.00 Chef::Cookbook#recipe_files=
0.00 18.29 0.00 246 0.00 0.00 Hash#[]=
0.00 18.29 0.00 1 0.00 0.00 Fixnum#==
0.00 18.29 0.00 2 0.00 0.00 Array#length
0.00 18.29 0.00 279 0.00 0.00 Mash#update
0.00 18.29 0.00 31 0.00 0.65 Chef::Cookbook::Metadata#license
0.00 18.29 0.00 76 0.00 0.66 Mash#[]=
0.00 18.29 0.00 76 0.00 0.00 Hash#regular_writer
0.00 18.29 0.00 76 0.00 0.00 Array#collect
0.00 18.29 0.00 28 0.00 0.00 Chef::Cookbook::Metadata#name
0.00 18.29 0.00 31 0.00 0.00 Chef::Cookbook::Metadata::Version#_parse
0.00 18.29 0.00 31 0.00 0.00 Array#each_index
0.00 18.29 0.00 686 0.00 0.00 File#basename
0.00 18.29 0.00 31 0.00 1.61 Chef::Cookbook::Metadata#description
0.00 18.29 0.00 62 0.00 0.00 File#exists?
0.00 18.29 0.00 1 0.00 0.00 Kernel.public_methods
0.00 18.29 0.00 155 0.00 0.00 Array#flatten
0.00 18.29 0.00 1 0.00 0.00 Kernel.nil?
0.00 18.29 0.00 2121 0.00 0.00 Hash#[]
0.00 18.29 0.00 28 0.00 0.00 Hash#key?
0.00 18.29 0.00 31 0.00 0.00 Chef::Cookbook#recipes
0.00 18.29 0.00 31 0.00 2.90 Chef::Cookbook::Metadata#maintainer
0.00 18.29 0.00 125 0.00 0.00 Dir#[]
0.00 18.29 0.00 1 0.00 18290.00 #toplevel
% cumulative self self total
time seconds seconds calls ms/call ms/call name
26.47 0.18 0.18 543 0.33 1.42 Array#each
8.82 0.24 0.06 124 0.48 0.56 Chef::Mixin::ParamsValidate._pv_opts_lookup
8.82 0.30 0.06 249 0.24 1.45 Hash#each
8.82 0.36 0.06 1028 0.06 1.08 Class#new
7.35 0.41 0.05 1533 0.03 0.03 Regexp#match
7.35 0.46 0.05 533 0.09 0.09 Symbol#to_s
4.41 0.49 0.03 31 0.97 0.97 Array#each_index
2.94 0.51 0.02 31 0.65 11.29 Chef::Cookbook::Metadata#initialize
2.94 0.53 0.02 28 0.71 1.07 Mash#default
2.94 0.55 0.02 1594 0.01 0.03 Hash#[]
1.47 0.56 0.01 104 0.10 0.10 Mash#convert_key
1.47 0.57 0.01 124 0.08 1.61 Chef::Mixin::ParamsValidate.validate
1.47 0.58 0.01 1 10.00 10.00 Kernel.public_methods
1.47 0.59 0.01 156 0.06 0.06 Array#flatten
1.47 0.60 0.01 1912 0.01 0.01 Hash#[]=
1.47 0.61 0.01 279 0.04 0.04 Mash#update
1.47 0.62 0.01 371 0.03 0.03 String#==
1.47 0.63 0.01 1533 0.01 0.01 MatchData#[]
1.47 0.64 0.01 76 0.13 0.13 Mash#convert_value
1.47 0.65 0.01 152 0.07 1.45 Chef::Mixin::ParamsValidate.set_or_return
1.47 0.66 0.01 31 0.32 0.65 Chef::Cookbook#initialize
1.47 0.67 0.01 248 0.04 0.04 Symbol#to_sym
1.47 0.68 0.01 124 0.08 0.81 Kernel.send
0.00 0.68 0.00 76 0.00 0.00 Hash#regular_writer
0.00 0.68 0.00 1 0.00 0.00 Fixnum#==
0.00 0.68 0.00 31 0.00 0.00 Chef::Cookbook::Metadata::Version#_parse
0.00 0.68 0.00 1 0.00 0.00 Array#reverse
0.00 0.68 0.00 31 0.00 1.94 Enumerable.inject
0.00 0.68 0.00 279 0.00 0.00 Hash#has_key?
0.00 0.68 0.00 1 0.00 0.00 Array#-
0.00 0.68 0.00 28 0.00 0.00 Mash#include?
0.00 0.68 0.00 31 0.00 0.32 Chef::Cookbook#recipes
0.00 0.68 0.00 76 0.00 0.00 Array#<<
0.00 0.68 0.00 1 0.00 670.00 Chef::CookbookLoader#load_cookbooks
0.00 0.68 0.00 76 0.00 0.26 Mash#[]=
0.00 0.68 0.00 31 0.00 2.58 Chef::Cookbook::Metadata#maintainer_email
0.00 0.68 0.00 31 0.00 0.00 Chef::Cookbook::Metadata::Version#initialize
0.00 0.68 0.00 248 0.00 0.00 Hash#values
0.00 0.68 0.00 124 0.00 0.00 Module#===
0.00 0.68 0.00 435 0.00 0.00 File#join
0.00 0.68 0.00 372 0.00 0.00 Array#initialize
0.00 0.68 0.00 76 0.00 0.00 Kernel.class
0.00 0.68 0.00 562 0.00 0.00 Hash#initialize
0.00 0.68 0.00 600 0.00 0.00 Kernel.kind_of?
0.00 0.68 0.00 77 0.00 0.00 Array#[]
0.00 0.68 0.00 1 0.00 0.00 Symbol#id2name
0.00 0.68 0.00 2 0.00 0.00 Fixnum#>
0.00 0.68 0.00 31 0.00 1.94 Chef::Cookbook::Metadata#description
0.00 0.68 0.00 279 0.00 0.04 Mash#initialize
0.00 0.68 0.00 383 0.00 0.00 Kernel.is_a?
0.00 0.68 0.00 28 0.00 0.00 Kernel.instance_variable_get
0.00 0.68 0.00 31 0.00 0.00 Proc#call
0.00 0.68 0.00 124 0.00 0.00 Kernel.respond_to?
0.00 0.68 0.00 124 0.00 0.00 Dir#glob
0.00 0.68 0.00 124 0.00 0.00 Kernel.instance_variable_set
0.00 0.68 0.00 279 0.00 0.00 Hash#each_pair
0.00 0.68 0.00 93 0.00 0.00 String#to_i
0.00 0.68 0.00 124 0.00 0.73 Chef::Mixin::ParamsValidate._pv_kind_of
0.00 0.68 0.00 76 0.00 0.66 Chef::Cookbook::Metadata#provides
0.00 0.68 0.00 32 0.00 0.00 File#directory?
0.00 0.68 0.00 2 0.00 0.00 Array#length
0.00 0.68 0.00 31 0.00 0.00 Hash#default
0.00 0.68 0.00 31 0.00 0.00 Chef::CookbookLoader#load_ignore_file
0.00 0.68 0.00 31 0.00 1.29 Chef::Cookbook::Metadata#maintainer
0.00 0.68 0.00 276 0.00 0.00 Kernel.==
0.00 0.68 0.00 76 0.00 0.00 Array#collect
0.00 0.68 0.00 124 0.00 1.37 Chef::CookbookLoader#load_cascading_files
0.00 0.68 0.00 31 0.00 0.00 Array#concat
0.00 0.68 0.00 76 0.00 0.00 Module#==
0.00 0.68 0.00 28 0.00 0.36 Chef::Cookbook::Metadata#name
0.00 0.68 0.00 1 0.00 0.00 Array#include?
0.00 0.68 0.00 1 0.00 670.00 Chef::CookbookLoader#initialize
0.00 0.68 0.00 62 0.00 0.00 File#exists?
0.00 0.68 0.00 248 0.00 0.00 Kernel.===
0.00 0.68 0.00 184 0.00 0.00 String#to_sym
0.00 0.68 0.00 31 0.00 0.97 Chef::Cookbook#recipe_files=
0.00 0.68 0.00 1 0.00 0.00 Chef::CookbookLoader#remove_ignored_files_from
0.00 0.68 0.00 107 0.00 0.00 Regexp#===
0.00 0.68 0.00 1 0.00 0.00 Kernel.nil?
0.00 0.68 0.00 1 0.00 10.00 Mixlib::Config.internal_set
0.00 0.68 0.00 31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment