Closed DmitryTsepelev closed 5 years ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
lib/ar_lazy_preload/contexts/base_context.rb | 26 | 27 | 96.3% | ||
<!-- | Total: | 70 | 71 | 98.59% | --> |
Totals | |
---|---|
Change from base Build 150: | 0.008% |
Covered Lines: | 551 |
Relevant Lines: | 552 |
Benchmark:
AR eager loading w/ 100% usage: 0.790239 0.023591 0.813830 ( 0.817788)
AR eager loading w/ 50% usage: 0.723016 0.008156 0.731172 ( 0.734528)
AR eager loading w/ 10% usage: 0.695915 0.006732 0.702647 ( 0.707186)
AR eager loading w/ 0% usage: 0.696657 0.006164 0.702821 ( 0.705940)
AR lazy preloading w/o auto_preload w/ 100% usage: 1.729192 0.017515 1.746707 ( 1.760358)
AR lazy preloading w/o auto_preload w/ 50% usage: 1.222130 0.011027 1.233157 ( 1.243240)
AR lazy preloading w/o auto_preload w/ 10% usage: 0.819979 0.007641 0.827620 ( 0.832342)
AR lazy preloading w/o auto_preload w/ 0% usage: 0.000589 0.000002 0.000591 ( 0.000587)
AR lazy preloading w/ auto_preload w/ 100% usage: 1.759815 0.015629 1.775444 ( 1.783938)
AR lazy preloading w/ auto_preload w/ 50% usage: 1.191837 0.011236 1.203073 ( 1.209880)
AR lazy preloading w/ auto_preload w/ 10% usage: 0.806014 0.006342 0.812356 ( 0.815726)
AR lazy preloading w/ auto_preload w/ 0% usage: 0.000568 0.000002 0.000570 ( 0.000566)
But now it's slow again 💣
Aha, force pushed the fix, thanks for the heads up
Memory report looks fine:
---------------------------------------------------
AR lazy preloading w/o auto_preload w/ 100% usage:
---------------------------------------------------
Total allocated: 50617408 bytes (601208 objects)
Total retained: 864 bytes (4 objects)
allocated memory by gem
-----------------------------------
29393904 activerecord-5.2.1.1
14968800 activemodel-5.2.1.1
4875024 sqlite3-1.3.13
880280 activesupport-5.2.1.1
373728 ar_lazy_preload
124776 arel-9.0.0
512 other
384 set
allocated memory by file
-----------------------------------
7927200 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute_set/builder.rb
7041600 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute.rb
6742080 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations.rb
6324960 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/result.rb
4874784 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb
4284272 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader/association.rb
4227840 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/persistence.rb
3668824 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/core.rb
1042240 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/reflection.rb
880800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/aggregations.rb
880000 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.1.1/lib/active_support/core_ext/numeric/conversions.rb
258960 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder.rb
243504 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation.rb
242760 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/scoping.rb
242400 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/collection_association.rb
226528 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/delegation.rb
220216 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/sqlite3_adapter.rb
193280 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/associated_context_builder.rb
177880 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/quoting.rb
177456 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/querying.rb
161600 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/collection_proxy.rb
161600 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/active_record/association.rb
81592 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/visitors/to_sql.rb
80800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/association.rb
80800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/scoping/named.rb
68768 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder/array_handler.rb
35512 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader.rb
17984 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/collectors/bind.rb
16944 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/contexts/base_context.rb
16320 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/predications.rb
6504 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/collectors/plain_string.rb
1344 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract_adapter.rb
1280 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/query_methods.rb
1152 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/query_cache.rb
920 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/context.rb
720 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/nodes/select_core.rb
704 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/association_tree_builder.rb
552 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/nodes/select_statement.rb
512 benchmark/memory.rb
424 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/spawn_methods.rb
400 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/where_clause.rb
384 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/table_metadata.rb
384 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/select_manager.rb
384 /users/pikachuexe/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/set.rb
360 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb
280 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/active_record/relation.rb
240 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/where_clause_factory.rb
240 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/sqlite3-1.3.13/lib/sqlite3/database.rb
200 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/table.rb
160 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/visitors/reduce.rb
allocated memory by location
-----------------------------------
6147840 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/result.rb:134
4855680 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108
4227840 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute_set/builder.rb:25
4227840 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations.rb:265
4227840 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/persistence.rb:71
3521600 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute.rb:9
3520320 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader/association.rb:36
2787904 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/core.rb:144
2514240 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations.rb:237
1937760 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute_set/builder.rb:16
1760000 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute.rb:13
1760000 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute.rb:71
960800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/reflection.rb:116
880800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute_set/builder.rb:115
880800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute_set/builder.rb:17
880800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/aggregations.rb:25
880800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/core.rb:541
880000 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.1.1/lib/active_support/core_ext/numeric/conversions.rb:107
479648 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader/association.rb:100
226528 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/delegation.rb:102
219560 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:222
208816 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader/association.rb:97
191808 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/associated_context_builder.rb:27
177760 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder.rb:60
176280 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/querying.rb:52
176280 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/result.rb:129
161840 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/scoping.rb:16
161600 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/collection_association.rb:35
161600 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/collection_proxy.rb:1118
161600 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/active_record/association.rb:7
81392 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/visitors/to_sql.rb:820
80920 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation.rb:25
80920 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation.rb:29
80920 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/scoping.rb:85
80880 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation.rb:195
80800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/association.rb:131
80800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/collection_association.rb:75
80800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/quoting.rb:161
80800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/quoting.rb:193
80800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/reflection.rb:589
80800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder.rb:61
80800 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/scoping/named.rb:58
58368 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader/association.rb:60
18104 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder/array_handler.rb:14
18104 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder/array_handler.rb:15
17984 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/collectors/bind.rb:7
17984 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:37
17944 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader.rb:155
16280 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/quoting.rb:145
16240 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader.rb:86
allocated memory by class
-----------------------------------
21041872 Hash
9921904 Array
5761744 String
3521600 ActiveModel::Attribute::FromDatabase
2400000 Comment
2288000 ActiveRecord::Associations::BelongsToAssociation
1937760 ActiveModel::LazyAttributeHash
1760000 ActiveModel::Attribute::FromUser
880800 ActiveModel::AttributeSet
384032 Post
226240 ActiveRecord::Associations::CollectionProxy
226240 ActiveRecord::Associations::HasManyAssociation
177760 ActiveRecord::Relation::QueryAttribute
80800 Arel::Nodes::BindParam
3872 User
768 Enumerator
712 ActiveRecord::Relation
320 Proc
312 Arel::Nodes::SelectCore
264 Arel::Nodes::SelectStatement
240 ActiveRecord::Associations::Preloader::Association
216 ActiveRecord::Result
200 Arel::Attributes::Attribute
160 ActiveRecord::Relation::WhereClause
160 SQLite3::Statement
152 ArLazyPreload::Contexts::LazyPreloadContext
120 Arel::Collectors::Bind
120 Arel::Collectors::Composite
120 Arel::Collectors::SQLString
120 Arel::Nodes::JoinSource
120 Arel::Nodes::SqlLiteral
120 Arel::SelectManager
80 ActiveRecord::Associations::Preloader
80 ActiveRecord::Relation::WhereClauseFactory
80 ArLazyPreload::AssociatedContextBuilder
80 ArLazyPreload::AssociationTreeBuilder
80 Arel::Nodes::And
80 Arel::Nodes::In
80 Set
allocated objects by gem
-----------------------------------
308821 activerecord-5.2.1.1
198100 activemodel-5.2.1.1
66094 sqlite3-1.3.13
22007 activesupport-5.2.1.1
4087 ar_lazy_preload
2092 arel-9.0.0
5 other
2 set
allocated objects by file
-----------------------------------
110020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute.rb
90050 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader/association.rb
88080 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute_set/builder.rb
66090 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb
46040 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations.rb
44043 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/core.rb
26046 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/reflection.rb
22042 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/result.rb
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/aggregations.rb
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/persistence.rb
22000 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.1.1/lib/active_support/core_ext/numeric/conversions.rb
6080 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation.rb
6069 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/scoping.rb
6060 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/collection_association.rb
4050 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder.rb
4043 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/quoting.rb
4040 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/collection_proxy.rb
4040 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/active_record/association.rb
2031 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/visitors/to_sql.rb
2023 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/delegation.rb
2020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/association.rb
2020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/scoping/named.rb
32 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/query_methods.rb
21 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/querying.rb
18 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader.rb
18 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder/array_handler.rb
18 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/nodes/select_core.rb
15 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract_adapter.rb
14 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/associated_context_builder.rb
12 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/sqlite3_adapter.rb
12 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/contexts/base_context.rb
10 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/where_clause.rb
9 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb
9 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/nodes/select_statement.rb
8 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/association_tree_builder.rb
7 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/active_record/relation.rb
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/query_cache.rb
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/where_clause_factory.rb
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/select_manager.rb
6 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/context.rb
5 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/table.rb
5 benchmark/memory.rb
4 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/predications.rb
4 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/visitors/reduce.rb
4 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/sqlite3-1.3.13/lib/sqlite3/database.rb
3 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/explain_subscriber.rb
3 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/spawn_methods.rb
3 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.1.1/lib/active_support/dependencies/interlock.rb
3 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel.rb
3 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/collectors/bind.rb
allocated objects by location
-----------------------------------
88008 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader/association.rb:36
66063 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:108
44020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute.rb:9
44000 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute.rb:71
24020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations.rb:237
24020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/reflection.rb:116
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute_set/builder.rb:115
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute_set/builder.rb:16
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute_set/builder.rb:17
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute_set/builder.rb:25
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/aggregations.rb:25
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations.rb:265
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/core.rb:144
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/core.rb:541
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/persistence.rb:71
22020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/result.rb:134
22000 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activemodel-5.2.1.1/lib/active_model/attribute.rb:13
22000 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.1.1/lib/active_support/core_ext/numeric/conversions.rb:107
4046 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/scoping.rb:16
4040 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/collection_association.rb:35
4040 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/collection_proxy.rb:1118
4040 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/active_record/association.rb:7
2026 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/visitors/to_sql.rb:820
2023 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation.rb:25
2023 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation.rb:29
2023 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/delegation.rb:102
2023 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/scoping.rb:85
2022 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader/association.rb:100
2022 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation.rb:195
2020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/association.rb:131
2020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/collection_association.rb:75
2020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/quoting.rb:161
2020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/quoting.rb:193
2020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/reflection.rb:589
2020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder.rb:60
2020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder.rb:61
2020 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/scoping/named.rb:58
16 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/result.rb:128
10 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:137
10 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb:140
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/associations/preloader/association.rb:97
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:23
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract/query_cache.rb:101
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:610
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/querying.rb:41
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder/array_handler.rb:14
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/predicate_builder/array_handler.rb:15
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.1.1/lib/active_record/relation/query_methods.rb:1048
6 /users/pikachuexe/.rvm/gems/ruby-2.5.3/gems/arel-9.0.0/lib/arel/nodes/select_statement.rb:8
6 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/context.rb:16
allocated objects by class
-----------------------------------
184556 Array
140263 Hash
114157 String
44020 ActiveModel::Attribute::FromDatabase
22020 ActiveModel::AttributeSet
22020 ActiveModel::LazyAttributeHash
22000 ActiveModel::Attribute::FromUser
22000 ActiveRecord::Associations::BelongsToAssociation
20000 Comment
2020 ActiveRecord::Associations::CollectionProxy
2020 ActiveRecord::Associations::HasManyAssociation
2020 ActiveRecord::Relation::QueryAttribute
2020 Arel::Nodes::BindParam
2000 Post
20 User
6 ActiveRecord::Relation
6 Enumerator
5 Arel::Attributes::Attribute
4 ActiveRecord::Relation::WhereClause
4 Proc
3 ActiveRecord::Result
3 Arel::Collectors::Bind
3 Arel::Collectors::Composite
3 Arel::Collectors::SQLString
3 Arel::Nodes::JoinSource
3 Arel::Nodes::SelectCore
3 Arel::Nodes::SelectStatement
3 Arel::Nodes::SqlLiteral
3 Arel::SelectManager
2 ActiveRecord::Associations::Preloader
2 ActiveRecord::Associations::Preloader::Association
2 ActiveRecord::Relation::WhereClauseFactory
2 ArLazyPreload::AssociatedContextBuilder
2 ArLazyPreload::AssociationTreeBuilder
2 ArLazyPreload::Contexts::LazyPreloadContext
2 Arel::Nodes::And
2 Arel::Nodes::In
2 SQLite3::Statement
2 Set
This PR:
193280 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/associated_context_builder.rb
161600 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/active_record/association.rb
Before:
352360 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/context.rb:29
213320 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/associated_context_builder.rb:27
161600 /users/pikachuexe/projects/ruby/gems/ar_lazy_preload/lib/ar_lazy_preload/active_record/association.rb:7
Can you release a new version? 🙏
Done, just shipped 0.2.6 🚢
Changes:
#association_loaded?
trickcompact!
to avoid annoingnil?
checks