Created
August 20, 2018 20:58
-
-
Save jonathan-wheeler/c4c8726773311f9785f22d4d1ca24eeb to your computer and use it in GitHub Desktop.
Benchmarks for reducing query_conditions_for_initial_load memory load
This file contains hidden or 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
y = 1 | |
Benchmark.memory do |x| | |
x.report(:master_large_multi_tenant_tenant_test) do | |
y.times do | |
ActiveRecord::Base.establish_connection(adapter: :postgresql, database: :large_multi_tenant_tenant_test).connection | |
ActiveRecord::Base.clear_active_connections! | |
end | |
end | |
x.report(:patch_large_multi_tenant_tenant_test) do | |
require 'active_record_postgresql_adapter_ext' | |
y.times do | |
ActiveRecord::Base.establish_connection(adapter: :postgresql, database: :large_multi_tenant_tenant_test).connection | |
end | |
end | |
x.compare! | |
end |
This file contains hidden or 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
y = 10 | |
Benchmark.memory do |x| | |
x.report(:master_single_tenant_test) do | |
y.times do | |
ActiveRecord::Base.establish_connection(adapter: :postgresql, database: :single_tenant_test).connection | |
end | |
end | |
x.report(:patch_single_tenant_test) do | |
require 'active_record_postgresql_adapter_ext' | |
y.times do | |
ActiveRecord::Base.establish_connection(adapter: :postgresql, database: :single_tenant_test).connection | |
ActiveRecord::Base.clear_active_connections! | |
end | |
end | |
x.compare! | |
end |
This file contains hidden or 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
y = 10 | |
Benchmark.bmbm do |x| | |
x.report(:master_large_multi_tenant_tenant_test) do | |
y.times do | |
ActiveRecord::Base.establish_connection(adapter: :postgresql, database: :large_multi_tenant_tenant_test).connection | |
end | |
end | |
x.report(:patch_large_multi_tenant_tenant_test) do | |
require 'active_record_postgresql_adapter_ext' | |
y.times do | |
ActiveRecord::Base.establish_connection(adapter: :postgresql, database: :large_multi_tenant_tenant_test).connection | |
end | |
end | |
end |
This file contains hidden or 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
y = 10 | |
Benchmark.bmbm do |x| | |
x.report(:master_single_tenant_test) do | |
y.times do | |
ActiveRecord::Base.establish_connection(adapter: :postgresql, database: :single_tenant_test).connection | |
end | |
end | |
x.report(:patch_single_tenant_test) do | |
require 'active_record_postgresql_adapter_ext' | |
y.times do | |
ActiveRecord::Base.establish_connection(adapter: :postgresql, database: :single_tenant_test).connection | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment