Currently when the RouteBuilder is compiling routes for the routing table it iterates over all the access checkers for every route. This seems unnecessary. It would make more sense to only iterate over the access checkers that apply for that route - this would reduce the amount of iterations and additional function calls by ALOT. This overhead could make a big difference on larger sites in particular (especially if we have to register access checkers for all the things - #2011424: Allow access methods on controllers to be used in routes).
Me and @dawehner discussed this briefly; We could have access checkers declare which requirement keys they apply to. We could then build a map of requirement keys => access checker ID and then just iterate over the requirements for each route and add the checkers that way.
Here is a *very* rough initial patch - Tests will likely fail hard, I've added an appliesTo() method to all the checkers, this is then used to compile a requirement map on the checker. So I have also changed the applies method on the AccessManager to reflect this.
Attachment | Size | Status | Test result | Operations |
---|---|---|---|---|
d8.access-requirement-map.patch | 14.8 KB | Idle | FAILED: [[SimpleTest]]: [MySQL] 56,929 pass(es), 2 fail(s), and 0 exception(s). | View details | Re-test |