diff options
author | Akira Matsuda <ronnie@dio.jp> | 2018-04-27 01:52:15 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2018-04-27 01:59:32 +0900 |
commit | ac93e7b5c192c39cfc224a1259a68c3b1e7bf0aa (patch) | |
tree | 80ae09ef444e0344fb56e1e856809c14333a809d /actionview/lib/action_view/helpers.rb | |
parent | 2929d165c23f0d3976425a8e70de77847cc4b872 (diff) | |
download | rails-ac93e7b5c192c39cfc224a1259a68c3b1e7bf0aa.tar.gz rails-ac93e7b5c192c39cfc224a1259a68c3b1e7bf0aa.tar.bz2 rails-ac93e7b5c192c39cfc224a1259a68c3b1e7bf0aa.zip |
Reduce extra object creations in TaggedLogging
tags_text method creates 3 Ruby objects per each logger call when no custom tags are given
(which is the default setting, and so presumably the majority use case).
This patch reduces two temporary object creations in this case.
require 'allocation_tracer'
ObjectSpace::AllocationTracer.setup(%i{type})
tags = ['a']
pp before: ObjectSpace::AllocationTracer.trace {
tags.collect { |tag| "[#{tag}] " }.join
}
pp after: ObjectSpace::AllocationTracer.trace {
"[#{tags[0]}] "
}
{:before=>{[:T_ARRAY]=>[1, 0, 0, 0, 0, 0], [:T_STRING]=>[2, 0, 0, 0, 0, 0]}}
{:after=>{[:T_STRING]=>[1, 0, 0, 0, 0, 0]}}
Diffstat (limited to 'actionview/lib/action_view/helpers.rb')
0 files changed, 0 insertions, 0 deletions