aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/log_subscriber.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Add allocations to template renderer subscriptionEileen Uchitelle2018-10-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | This PR adds the allocations to the instrumentation for template and partial rendering. Before: ``` Rendering posts/new.html.erb within layouts/application Rendered posts/_form.html.erb (9.7ms) Rendered posts/new.html.erb within layouts/application (10.9ms) Completed 200 OK in 902ms (Views: 890.8ms | ActiveRecord: 0.8ms) ``` After: ``` Rendering posts/new.html.erb within layouts/application Rendered posts/_form.html.erb (Duration: 7.1ms | Allocations: 6004) Rendered posts/new.html.erb within layouts/application (Duration: 8.3ms | Allocations: 6654) Completed 200 OK in 858ms (Views: 848.4ms | ActiveRecord: 0.4ms | Allocations: 1539564) ```
* Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* [Action View] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Prepare AP and AR to be frozen string friendlyKir Shatrov2017-07-061-1/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-021-0/+1
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| |
* | Make ActionView frozen string literal friendly.Pat Allan2017-06-201-2/+2
|/ | | | Plus a couple of related ActionPack patches.
* Merge pull request https://github.com/rails/rails/pull/28637 from ↵Kasper Timm Hansen2017-06-081-3/+4
| | | | st0012/fix-partial-cache-logging
* Privatize unneededly protected methods in Action ViewAkira Matsuda2016-12-241-7/+5
|
* Modify LogSubscriber for single partial's cache message.Stan Lo2016-08-081-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement naive partial caching mechanism. Add test for LogSubscriber Use ActionView::Base#log_payload to store log_subscriber's payload, so we can pass cache result into it. Fixed tests Remove useless settings Check if #log_payload exists before calling it. Because other classes also includes CacheHelper but don't have is attribute Use @log_payload_for_partial_reder instead of #log_payload to carry ActionView's payload. Update test's hash syntax Add configuration to enable/disable fragment caching logging Remove unless test and add new test to ensure cache info won't effect next rendering's log Move :enable_fragment_cache_logging config from ActionView to ActionPack Apply new config to tests Update actionview's changelog Update configuration guide Improve actionview's changelog Refactor PartialRenderer#render and log tests Mute subscriber's log instead of disabling instrumentation. Fix typo, remove useless comment and use new hash syntax Improve actionpack's log_subscriber test Fix rebase mistake Apply new config to all caching intstrument actions
* applies new string literal convention in actionview/libXavier Noria2016-08-061-3/+3
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Update to use Subscriber#start insteadPrem Sichanugrist2016-02-261-6/+15
| | | | | | | | We don't need to instrument another event as `ActiveSupport::LogSubscriber` already tracks when the instrumentation starts. Close #23717
* Added log "Rendering ...", when starting to render a template, to log that ↵Vipul A M2016-02-261-0/+9
| | | | | | | | we have started to render something, at the very beginning. This helps to easily identify queries from controller vs views Fixes #23710
* Instrument cached collection renders.Kasper Timm Hansen2016-02-201-1/+17
| | | | | | | | | | | | | | | | Augments the collection caching with some instrumentation that's logged. For collections that have been cached like: ```ruby <%= render partial: 'notifications/notification', collection: @notifications, cached: true %> ``` We'll output a line showing how many cache hits we had when rendering it: ``` Rendered collection of notifications/_notification.html.erb [0 / 100 cache hits] (3396.5ms) ```
* Prefer to pass block when logging.Guo Xiang Tan2014-07-181-5/+5
| | | | | | | | The Logger by default includes a guard which checks for the logging level. By removing the custom logging guards, we can decouple the logging guard from the logging action to be done. This also follows the good practice listed on http://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance.
* Drop one more string allocationRafael Mendonça França2013-11-091-1/+3
|
* sub! can return nilArun Agrawal2013-11-071-1/+1
| | | | | | Revert "drop one more string allocation" This reverts commit 4d15661d6c46c86a62ee1fc358f4b3ef9dd9f2ea.
* drop one more string allocationAaron Patterson2013-11-061-1/+1
|
* drop string allocations in the log subscriberAaron Patterson2013-11-061-2/+12
|
* Add missing requireŁukasz Strzałkowski2013-08-251-0/+2
|
* Move actionpack/lib/action_view* into actionview/libPiotr Sarnacki2013-06-201-0/+30