← Graph

Rails RouteSet clear

concept 2 connections

ActionDispatch::Routing::RouteSet#clear iterates over the _path_helpers and _url_helpers modules and calls undef_method for every generated helper, then rebuilds them when routes are reloaded. Because those modules are (indirectly) included in every controller in the application, the cost scales with the number of controllers. In the talk, this method dominated the flame graph and grew with each reload because controllers were accumulating.

category
architecture
about
Rails RouteSet clear concept
Traces the slowdown to RouteSet#clear undef_methoding URL/path helpers on every reload.
concept Rails RouteSet clear
related_to
Rails internal method in ActionDispatch::Routing::RouteSet.

Provenance

Read by
6 extractions