Skip to content

Commit

Permalink
One less String allocation for event.allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
amatsuda committed Jan 6, 2023
1 parent 3d00c8b commit ae569ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/log_subscriber.rb
Expand Up @@ -31,7 +31,7 @@ def process_action(event)
status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception_class_name)
end

additions << "Allocations: #{event.allocations}"
additions << "Allocations: " << event.allocations

message = +"Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{event.duration.round}ms" \
" (#{additions.join(" | ")})"
Expand Down

2 comments on commit ae569ea

@skipkayhil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amatsuda test failures look real:

rails test /rails/actionview/test/activerecord/controller_runtime_test.rb:66

Expected /\(Views: [\d.]+ms \| ActiveRecord: ([1-9][\d.]+)ms \| Allocations: [\d.]+\)/ to match "Completed 200 OK in 0ms (Views: 0.3ms | ActiveRecord: 100.0ms | Allocations:  | 163)".

@amatsuda
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skipkayhil Ugh, just reverted. Thank you for letting me know.

Please sign in to comment.