diff options
author | Arthur Nogueira Neves <github@arthurnn.com> | 2016-05-20 12:27:28 -0400 |
---|---|---|
committer | Arthur Nogueira Neves <github@arthurnn.com> | 2016-05-20 12:27:28 -0400 |
commit | 350a6532fc9af31c7ca6c404f03c062310e2a373 (patch) | |
tree | 15ec6cf8a5b30f3c6536d74417af195e8cae8a48 | |
parent | 0670a64481d151854c909035841d256d9b906edc (diff) | |
parent | 70d504f626d0a68ce927cd0fddf9af7eec1a3f29 (diff) | |
download | rails-350a6532fc9af31c7ca6c404f03c062310e2a373.tar.gz rails-350a6532fc9af31c7ca6c404f03c062310e2a373.tar.bz2 rails-350a6532fc9af31c7ca6c404f03c062310e2a373.zip |
Merge pull request #25085 from bquorning/update-comment-for-retrieve_connection_pool
Update comment for #retrieve_connection_pool
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index f3abd01290..f437dafec2 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -896,15 +896,9 @@ module ActiveRecord end end - # Retrieving the connection pool happens a lot so we cache it in @class_to_pool. + # Retrieving the connection pool happens a lot, so we cache it in @owner_to_pool. # This makes retrieving the connection pool O(1) once the process is warm. # When a connection is established or removed, we invalidate the cache. - # - # Ideally we would use #fetch here, as class_to_pool[klass] may sometimes be nil. - # However, benchmarking (https://gist.github.com/jonleighton/3552829) showed that - # #fetch is significantly slower than #[]. So in the nil case, no caching will - # take place, but that's ok since the nil case is not the common one that we wish - # to optimise for. def retrieve_connection_pool(spec_name) owner_to_pool.fetch(spec_name) do # Check if a connection was previously established in an ancestor process, |