How to use Dependency Injection & Services for unexpected performance gains
summary
XHProf profiling identifies a single global access function costing ~50% of page time; switching from entity queries to direct DB queries saves ~15–20% but the big win is converting the logic into a service and storing its result as a property so the expensive computation runs once per request instead of ~100 times, yielding roughly a 60% site performance improvement. Tools: XHProf profiling, single-request cache via service property.
AI-written summary · about
