Reduce calls to CRM_Utils_System::url() in mailings
On Drupal 8+ and possibly on other CMSes, CRM_Utils_System::url()
takes an absurdly long time to run. Seems like \Drupal\Core\Utility\UnroutedUrlAssembler::assemble()
is the main culprit, but even that's only part of the problem.
When generating VERP URLs, we call CRM_Utils_System::url()
5 times per email, to generate almost-identical URLs. Simply reducing that to one call per email cut my test mail sending by just over 25%!
There are further improvements to be made, I'd love to hear folks' feedback.
- Do we even need to call
\Drupal\Core\Url::fromUri()
every time we callCRM_Utils_System::url()
? Is there a faster way to generate URLs? - Many email service providers (Mailjet, Sparkpost etc.) emit a webhook on bounce. What if we created a "Disable VERP" setting?