Created
March 2, 2015 02:26
-
-
Save dangalipo/b5580b9730eaa03aeb90 to your computer and use it in GitHub Desktop.
profiling results lazy(foo) vs non_lazy(moo)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c =[#<CaseComponent id: 99712, case_id: 34007, position: 1, itemable_id: 4744, itemable_type: "QuizQuestion">, #<CaseComponent id: 99674, case_id: 34007, position: 1, itemable_id: 34007, itemable_type: "Presentation">, #<CaseComponent id: 99711, case_id: 34007, position: 2, itemable_id: 4743, itemable_type: "QuizQuestion">, #<CaseComponent id: 99710, case_id: 34007, position: 3, itemable_id: 4742, itemable_type: "QuizQuestion">, #<CaseComponent id: 99709, case_id: 34007, position: 4, itemable_id: 4741, itemable_type: "QuizQuestion">, #<CaseComponent id: 99708, case_id: 34007, position: 5, itemable_id: 4740, itemable_type: "QuizQuestion">, #<CaseComponent id: 99707, case_id: 34007, position: 6, itemable_id: 4739, itemable_type: "QuizQuestion">, #<CaseComponent id: 99704, case_id: 34007, position: 7, itemable_id: 4737, itemable_type: "QuizQuestion">, #<CaseComponent id: 99702, case_id: 34007, position: 8, itemable_id: 4736, itemable_type: "QuizQuestion">, #<CaseComponent id: 99700, case_id: 34007, position: 9, itemable_id: 35233, itemable_type: "Study">, #<CaseComponent id: 99698, case_id: 34007, position: 10, itemable_id: 4735, itemable_type: "QuizQuestion">, #<CaseComponent id: 99696, case_id: 34007, position: 11, itemable_id: 4734, itemable_type: "QuizQuestion">, #<CaseComponent id: 99695, case_id: 34007, position: 12, itemable_id: 4733, itemable_type: "QuizQuestion">, #<CaseComponent id: 99692, case_id: 34007, position: 14, itemable_id: 4732, itemable_type: "QuizQuestion">, #<CaseComponent id: 99689, case_id: 34007, position: 15, itemable_id: 4730, itemable_type: "QuizQuestion">, #<CaseComponent id: 99690, case_id: 34007, position: 15, itemable_id: 4731, itemable_type: "QuizQuestion">, #<CaseComponent id: 99688, case_id: 34007, position: 17, itemable_id: 4729, itemable_type: "QuizQuestion">, #<CaseComponent id: 99687, case_id: 34007, position: 18, itemable_id: 35232, itemable_type: "Study">, #<CaseComponent id: 99686, case_id: 34007, position: 19, itemable_id: 4728, itemable_type: "QuizQuestion">, #<CaseComponent id: 99685, case_id: 34007, position: 20, itemable_id: 4727, itemable_type: "QuizQuestion">, #<CaseComponent id: 99684, case_id: 34007, position: 21, itemable_id: 4726, itemable_type: "QuizQuestion">, #<CaseComponent id: 99683, case_id: 34007, position: 22, itemable_id: 4725, itemable_type: "QuizQuestion">, #<CaseComponent id: 99682, case_id: 34007, position: 23, itemable_id: 4724, itemable_type: "QuizQuestion">, #<CaseComponent id: 99681, case_id: 34007, position: 24, itemable_id: 4723, itemable_type: "QuizQuestion">, #<CaseComponent id: 99680, case_id: 34007, position: 25, itemable_id: 35231, itemable_type: "Study">, #<CaseComponent id: 99679, case_id: 34007, position: 26, itemable_id: 4722, itemable_type: "QuizQuestion">, #<CaseComponent id: 99677, case_id: 34007, position: 27, itemable_id: 4720, itemable_type: "QuizQuestion">, #<CaseComponent id: 99678, case_id: 34007, position: 28, itemable_id: 4721, itemable_type: "QuizQuestion">, #<CaseComponent id: 99676, case_id: 34007, position: 29, itemable_id: 4719, itemable_type: "QuizQuestion">, #<CaseComponent id: 99673, case_id: 34007, position: 30, itemable_id: 35230, itemable_type: "Study">, #<CaseComponent id: 99691, case_id: 34007, position: 31, itemable_id: 4731, itemable_type: "QuizQuestion">, #<CaseComponent id: 99693, case_id: 34007, position: 32, itemable_id: 4732, itemable_type: "QuizQuestion">, #<CaseComponent id: 99694, case_id: 34007, position: 33, itemable_id: 4733, itemable_type: "QuizQuestion">, #<CaseComponent id: 99697, case_id: 34007, position: 34, itemable_id: 4734, itemable_type: "QuizQuestion">, #<CaseComponent id: 99699, case_id: 34007, position: 35, itemable_id: 4735, itemable_type: "QuizQuestion">, #<CaseComponent id: 99701, case_id: 34007, position: 36, itemable_id: 35233, itemable_type: "Study">, #<CaseComponent id: 99703, case_id: 34007, position: 37, itemable_id: 4736, itemable_type: "QuizQuestion">, #<CaseComponent id: 99705, case_id: 34007, position: 38, itemable_id: 4737, itemable_type: "QuizQuestion">, #<CaseComponent id: 99706, case_id: 34007, position: 39, itemable_id: 4738, itemable_type: "QuizQuestion">, #<CaseComponent id: 99675, case_id: 34007, position: 40, itemable_id: 34007, itemable_type: "Discussion">] | |
irb(main):024:0> foo c | |
Measure Mode: wall_time | |
Thread ID: 70217015647160 | |
Fiber ID: 70217017940040 | |
Total: 0.002658 | |
Sort by: self_time | |
%self total self wait child calls name | |
21.54 0.001 0.001 0.000 0.001 19 ActiveSupport::Inflector#underscore | |
20.60 0.001 0.001 0.000 0.000 76 String#gsub! | |
5.67 0.000 0.000 0.000 0.000 24 ActiveRecord::AttributeMethods::Read::ClassMethods#type_cast_attribute | |
2.40 0.000 0.000 0.000 0.000 16 <Class::ActiveRecord::ConnectionAdapters::Column>#value_to_integer | |
2.40 0.000 0.000 0.000 0.000 19 #<Module:0x007fb95f205a38>#__temp__ | |
1.88 0.000 0.000 0.000 0.000 19 ActiveSupport::Inflector#inflections | |
1.86 0.000 0.000 0.000 0.000 48 ActiveRecord::AttributeMethods::ClassMethods#generated_external_attribute_methods | |
1.67 0.000 0.000 0.000 0.000 43 Hash#has_key? | |
1.61 0.000 0.000 0.000 0.000 24 ActiveRecord::AttributeMethods::Read#read_attribute | |
1.53 0.000 0.000 0.000 0.000 19 Regexp#to_s | |
1.44 0.000 0.000 0.000 0.000 24 ActiveRecord::Base#[] | |
1.44 0.002 0.000 0.000 0.001 19 CaseComponent(id: integer, case_id: integer, position: integer, itemable_id: integer, itemable_type: string)#polytype | |
1.38 0.001 0.000 0.000 0.001 8 ActiveRecord::Associations::BelongsToPolymorphicAssociation#stale_state | |
1.37 0.000 0.000 0.000 0.000 19 Kernel#dup | |
1.35 0.000 0.000 0.000 0.000 24 #<Module:0x007fb95e7d1918>#__temp__ | |
1.35 0.000 0.000 0.000 0.000 59 String#to_s | |
1.30 0.001 0.000 0.000 0.001 19 String#underscore | |
1.24 0.000 0.000 0.000 0.000 8 ActiveRecord::Associations::BelongsToAssociation#stale_state | |
1.17 0.002 0.000 0.000 0.002 25 *Enumerator::Yielder#yield | |
1.09 0.000 0.000 0.000 0.000 8 ActiveRecord::Associations#association | |
0.99 0.000 0.000 0.000 0.000 19 String#tr! | |
0.94 0.000 0.000 0.000 0.000 17 ActiveRecord::Associations::Association#loaded? | |
0.93 0.000 0.000 0.000 0.000 24 Module#method_defined? | |
0.92 0.001 0.000 0.000 0.001 8 ActiveRecord::Associations::SingularAssociation#reader | |
0.92 0.001 0.000 0.000 0.001 8 CaseComponent::GeneratedFeatureMethods#itemable | |
0.92 0.003 0.000 0.000 0.003 1 Object#foo | |
0.91 0.001 0.000 0.000 0.001 8 ActiveRecord::Associations::Association#stale_target? | |
0.91 0.001 0.000 0.000 0.001 10 CaseComponent(id: integer, case_id: integer, position: integer, itemable_id: integer, itemable_type: string)#presentation? | |
0.83 0.000 0.000 0.000 0.000 16 ActiveRecord::Reflection::AssociationReflection#foreign_key | |
0.83 0.002 0.000 0.000 0.002 1 Array#each | |
0.78 0.000 0.000 0.000 0.000 8 Fixnum#to_s | |
0.76 0.000 0.000 0.000 0.000 24 Kernel#class | |
0.76 0.001 0.000 0.000 0.001 9 CaseComponent(id: integer, case_id: integer, position: integer, itemable_id: integer, itemable_type: string)#question? | |
0.75 0.000 0.000 0.000 0.000 19 String#initialize_copy | |
0.75 0.000 0.000 0.000 0.000 19 <Class::ActiveSupport::Inflector::Inflections>#instance | |
0.67 0.000 0.000 0.000 0.000 8 ActiveRecord::Associations#association_instance_get | |
0.67 0.000 0.000 0.000 0.000 8 Array#== | |
0.66 0.000 0.000 0.000 0.000 32 Module#=== | |
0.65 0.000 0.000 0.000 0.000 19 Kernel#initialize_dup | |
0.59 0.000 0.000 0.000 0.000 19 String#downcase! | |
0.57 0.000 0.000 0.000 0.000 19 Kernel#block_given? | |
0.48 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::CollectionProxy#method_missing | |
0.45 0.000 0.000 0.000 0.000 8 BasicObject#!= | |
0.42 0.000 0.000 0.000 0.000 8 ActiveRecord::Reflection::AssociationReflection#foreign_type | |
0.42 0.000 0.000 0.000 0.000 3 Enumerator::Generator#initialize | |
0.38 0.000 0.000 0.000 0.000 16 Integer#to_i | |
0.38 0.000 0.000 0.000 0.000 1 <Class::ActiveRecord::DynamicFinderMatch>#match | |
0.37 0.000 0.000 0.000 0.000 3 Enumerator::Lazy#initialize | |
0.34 0.000 0.000 0.000 0.000 3 Class#new | |
0.27 0.000 0.000 0.000 0.000 8 Symbol#to_sym | |
0.27 0.000 0.000 0.000 0.000 2 Kernel#respond_to? | |
0.27 0.000 0.000 0.000 0.000 8 String#== | |
0.27 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::CollectionAssociation#load_target | |
0.26 0.000 0.000 0.000 0.000 4 Regexp#=== | |
0.26 0.000 0.000 0.000 0.000 3 ActiveRecord::Associations::CollectionProxy#target | |
0.22 0.003 0.000 0.000 0.003 3 *Enumerator::Generator#each | |
0.19 0.000 0.000 0.000 0.000 1 Enumerator::Lazy#reject | |
0.19 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::Association#loaded! | |
0.19 0.000 0.000 0.000 0.000 1 Enumerable#lazy | |
0.19 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::CollectionProxy#load_target | |
0.18 0.000 0.000 0.000 0.000 8 Kernel#nil? | |
0.16 0.003 0.000 0.000 0.003 1 Enumerable#to_a | |
0.14 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::Association#find_target? | |
0.12 0.000 0.000 0.000 0.000 3 Symbol#to_proc | |
0.12 0.000 0.000 0.000 0.000 1 Symbol#to_s | |
0.11 0.000 0.000 0.000 0.000 1 Enumerator::Lazy#collect | |
0.11 0.003 0.000 0.000 0.003 4 *Enumerator#each | |
0.08 0.000 0.000 0.000 0.000 1 Enumerator::Lazy#take_while | |
0.04 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::Association#stale_state | |
* indicates recursively called methods | |
=> [#<RubyProf::Thread:0x007fb963809458>] | |
irb(main):025:0> moo c | |
Measure Mode: wall_time | |
Thread ID: 70217015647160 | |
Fiber ID: 70217017940040 | |
Total: 0.003402 | |
Sort by: self_time | |
%self total self wait child calls name | |
29.35 0.002 0.001 0.000 0.001 49 ActiveSupport::Inflector#underscore | |
28.43 0.001 0.001 0.000 0.000 196 String#gsub! | |
3.32 0.000 0.000 0.000 0.000 49 #<Module:0x007fb95f205a38>#__temp__ | |
3.26 0.000 0.000 0.000 0.000 24 ActiveRecord::AttributeMethods::Read::ClassMethods#type_cast_attribute | |
2.50 0.000 0.000 0.000 0.000 49 ActiveSupport::Inflector#inflections | |
2.05 0.003 0.000 0.000 0.003 49 CaseComponent(id: integer, case_id: integer, position: integer, itemable_id: integer, itemable_type: string)#polytype | |
1.77 0.000 0.000 0.000 0.000 49 Regexp#to_s | |
1.73 0.000 0.000 0.000 0.000 73 Hash#has_key? | |
1.65 0.002 0.000 0.000 0.002 49 String#underscore | |
1.65 0.002 0.000 0.000 0.002 40 CaseComponent(id: integer, case_id: integer, position: integer, itemable_id: integer, itemable_type: string)#presentation? | |
1.58 0.000 0.000 0.000 0.000 49 Kernel#dup | |
1.37 0.000 0.000 0.000 0.000 49 String#tr! | |
1.31 0.000 0.000 0.000 0.000 49 Kernel#initialize_dup | |
1.26 0.002 0.000 0.000 0.002 1 Array#reject | |
1.15 0.000 0.000 0.000 0.000 8 ActiveRecord::Associations::BelongsToPolymorphicAssociation#stale_state | |
1.11 0.000 0.000 0.000 0.000 49 <Class::ActiveSupport::Inflector::Inflections>#instance | |
1.06 0.000 0.000 0.000 0.000 16 <Class::ActiveRecord::ConnectionAdapters::Column>#value_to_integer | |
0.89 0.000 0.000 0.000 0.000 24 ActiveRecord::AttributeMethods::Read#read_attribute | |
0.85 0.000 0.000 0.000 0.000 48 ActiveRecord::AttributeMethods::ClassMethods#generated_external_attribute_methods | |
0.83 0.000 0.000 0.000 0.000 49 String#initialize_copy | |
0.80 0.000 0.000 0.000 0.000 89 String#to_s | |
0.73 0.000 0.000 0.000 0.000 24 #<Module:0x007fb95e7d1918>#__temp__ | |
0.73 0.000 0.000 0.000 0.000 24 ActiveRecord::Base#[] | |
0.68 0.000 0.000 0.000 0.000 49 String#downcase! | |
0.60 0.000 0.000 0.000 0.000 8 ActiveRecord::Associations#association | |
0.57 0.000 0.000 0.000 0.000 49 Kernel#block_given? | |
0.56 0.003 0.000 0.000 0.003 1 Object#moo | |
0.49 0.001 0.000 0.000 0.001 8 CaseComponent::GeneratedFeatureMethods#itemable | |
0.49 0.000 0.000 0.000 0.000 8 ActiveRecord::Associations::BelongsToAssociation#stale_state | |
0.47 0.000 0.000 0.000 0.000 17 ActiveRecord::Associations::Association#loaded? | |
0.47 0.000 0.000 0.000 0.000 8 ActiveRecord::Associations::SingularAssociation#reader | |
0.46 0.000 0.000 0.000 0.000 8 ActiveRecord::Associations::Association#stale_target? | |
0.42 0.000 0.000 0.000 0.000 16 ActiveRecord::Reflection::AssociationReflection#foreign_key | |
0.38 0.000 0.000 0.000 0.000 32 Module#=== | |
0.34 0.000 0.000 0.000 0.000 24 Module#method_defined? | |
0.34 0.000 0.000 0.000 0.000 24 Kernel#class | |
0.32 0.000 0.000 0.000 0.000 9 CaseComponent(id: integer, case_id: integer, position: integer, itemable_id: integer, itemable_type: string)#question? | |
0.32 0.002 0.000 0.000 0.002 1 ActiveRecord::Associations::CollectionProxy#method_missing | |
0.30 0.000 0.000 0.000 0.000 1 Array#take_while | |
0.29 0.000 0.000 0.000 0.000 8 Array#== | |
0.27 0.001 0.000 0.000 0.001 1 Array#collect | |
0.23 0.000 0.000 0.000 0.000 8 ActiveRecord::Associations#association_instance_get | |
0.23 0.000 0.000 0.000 0.000 4 Regexp#=== | |
0.23 0.000 0.000 0.000 0.000 8 Symbol#to_sym | |
0.22 0.000 0.000 0.000 0.000 8 Fixnum#to_s | |
0.19 0.000 0.000 0.000 0.000 1 <Class::ActiveRecord::DynamicFinderMatch>#match | |
0.18 0.000 0.000 0.000 0.000 16 Integer#to_i | |
0.18 0.000 0.000 0.000 0.000 3 ActiveRecord::Associations::CollectionProxy#target | |
0.18 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::CollectionAssociation#load_target | |
0.18 0.000 0.000 0.000 0.000 8 String#== | |
0.15 0.000 0.000 0.000 0.000 8 BasicObject#!= | |
0.15 0.000 0.000 0.000 0.000 8 ActiveRecord::Reflection::AssociationReflection#foreign_type | |
0.12 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::CollectionProxy#load_target | |
0.11 0.000 0.000 0.000 0.000 3 Symbol#to_proc | |
0.10 0.000 0.000 0.000 0.000 8 Kernel#nil? | |
0.09 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::Association#find_target? | |
0.09 0.000 0.000 0.000 0.000 2 Kernel#respond_to? | |
0.08 0.000 0.000 0.000 0.000 1 Symbol#to_s | |
0.08 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::Association#loaded! | |
0.06 0.000 0.000 0.000 0.000 1 ActiveRecord::Associations::Association#stale_state | |
* indicates recursively called methods | |
=> [#<RubyProf::Thread:0x007fb9621ca250>] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment