Optimize parse_request for the home page (empty request)
|Reported by:||duck_||Owned by:||ryan|
|Component:||Rewrite Rules||Keywords:||has-patch commit 3.3-early|
When you visit a site's home page the request (WP::$request) is empty. However we still try to match it against every rewrite rule. By default none of the rules will match. This can be particularly bad when verbose page rules are enabled and WordPress is attempting 700+ regex matches (~50 pages) or more for especially large page oriented sites on an empty string.
The only reason against breaking from the loop like we do for wp-app.php in this case I could think of is if a plugin has added an extra rule to match ^$. If we want to allow this then maybe manually check for a rule == $ and still break early.
 This can currently be blocked by #17176 as ()(/[0-9]+)?/?$ matches an empty string
Change History (22)
- Component changed from Performance to Rewrite Rules
- Milestone changed from Future Release to 3.3
comment:10 ryan — 3 years ago
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed