# Drupal 9.5.0 Profiling
This compares profiling of the same code base running Drupal **9.4.9** and **9.5.0**. Profiling was done locally using `xhprof`. All Drupal caches were cleared when switching drupal core versions.
The totals are averages from 3 runs of each test case. The call stack is ordered by descending wall time and taken from just one run that I thought described the average order.
The biggest thing that stands out to me is the time spent running `Container::getServiceIdMappings` and `Container::generateServiceIdHash`. Also, the number of calls to `DefaultPluginManager::cacheSet` went up on the cold start.
## Cold Start - Home Page
### Drupal 9.4.9
<table>
<tr>
<th>Total Time</th>
<td>12s</td>
</tr>
<tr>
<th>Total Calls</th>
<td>2.8 million</td>
</tr>
</table>
| Function Name | Calls | Excl. Time | % Time |
|---|---|---|---|
| Drupal\Core\Entity\EntityFieldManager::cacheSet | 221 | 1.8s | 15.7% |
| Drupal\Core\Config\ConfigFactory::loadMultiple | 1,101 | 620ms | 5.2% |
| Drupal\views\Plugin\views\display\DisplayPluginBase::initDisplay | 369 | 590ms | 5.0% |
| Drupal\Core\Plugin\DefaultPluginManager::cacheSet | 34 | 570ms | 4.8% |
### Drupal 9.5.0
<table>
<tr>
<th>Total Time</th>
<td>40s</td>
</tr>
<tr>
<th>Total Calls</th>
<td>28.1 million</td>
</tr>
</table>
| Function Name | Calls | Excl. Time | % Time |
|---|---|---|---|
| Drupal\Component\DependencyInjection\Container::getServiceIdMappings | 17,774 | 14.5s | 36.3% |
| Drupal\Component\DependencyInjection\Container::generateServiceIdHash | 7,109,986 | 9.8s | 24.5% |
| Drupal\Component\DependencyInjection\Container::initialized | 18,164,456 | 2.5s | 6.2% |
| Drupal\Core\Plugin\DefaultPluginManager::cacheSet | 221 | 1.9s | 4.7% |
### Drupal 9.5.0 ([3327856-6.patch](https://www.drupal.org/project/drupal/issues/3327856#comment-14829079))
<table>
<tr>
<th>Total Time</th>
<td>26s</td>
</tr>
<tr>
<th>Total Calls</th>
<td>15.8 million</td>
</tr>
</table>
| Function Name | Calls | Excl. Time | % Time |
|---|---|---|---|
| Drupal\Component\DependencyInjection\Container::getServiceIdMappings | 9,265 | 7.8s | 29.0% |
| Drupal\Component\DependencyInjection\Container::generateServiceIdHash | 3,700,939 | 5.3s | 19.8% |
| Drupal\Core\Plugin\DefaultPluginManager::cacheSet | 34 | 1.8s | 7.0% |
| Drupal\Component\DependencyInjection\Container::initialized | 18,164,456 | 1.3s | 5.0% |
### Drupal 9.5.0 ([3327856-16.patch](https://www.drupal.org/project/drupal/issues/3327856#comment-14829464))
<table>
<tr>
<th>Total Time</th>
<td>11.3s</td>
</tr>
<tr>
<th>Total Calls</th>
<td>2.6 million</td>
</tr>
</table>
| Function Name | Calls | Excl. Time | % Time |
|---|---|---|---|
| Drupal\Core\Entity\EntityFieldManager::cacheSet | 221 | 1.8s | 16.2% |
| Drupal\Core\Plugin\DefaultPluginManager::cacheSet | 34 | 665ms | 5.9% |
| Drupal\Core\Config\ConfigFactory::loadMultiple | 1,101 | 576ms | 5.1% |
| Drupal\views\Plugin\views\display\DisplayPluginBase::initDisplay | 369 | 561ms | 4.9% |
## Uncached General Page
### Drupal 9.4.9
<table>
<tr>
<th>Total Time</th>
<td>7.2s</td>
</tr>
<tr>
<th>Total Calls</th>
<td>2.3 million</td>
</tr>
</table>
| Function Name | Calls | Excl. Time | % Time |
|---|---|---|---|
| GuzzleHttp\Handler\CurlHandler::\_\_invoke | 4 | 980ms | 13.8% |
| Drupal\Core\Entity\ContentEntityStorageBase::setPersistentCache | 138 | 613ms | 8.6% |
| Drupal\Core\Url::toString | 3,129 | 362ms | 5.1% |
| Drupal\Core\Entity\Sql\SqlContentEntityStorage::loadFromDedicatedTables | 151 | 325ms | 4.6% |
### Drupal 9.5.0
<table>
<tr>
<th>Total Time</th>
<td>14.5s</td>
</tr>
<tr>
<th>Total Calls</th>
<td>2.3 million</td>
</tr>
</table>
| Function Name | Calls | Excl. Time | % Time |
|---|---|---|---|
| Drupal\Core\Plugin\Context\ContextDefinition::\_\_sleep | 9,421 | 6.9s | 34.1% |
| GuzzleHttp\Handler\CurlHandler::\_\_invoke | 4 | 971ms | 8.1% |
| Drupal\Core\Entity\ContentEntityStorageBase::setPersistentCache | 138 | 670ms | 5.8% |
| Drupal\Core\Entity\EntityBase::traitSleep | 657 | 637ms | 3.6% |
### Drupal 9.5.0 ([3327856-6.patch](https://www.drupal.org/project/drupal/issues/3327856#comment-14829079))
<table>
<tr>
<th>Total Time</th>
<td>11s</td>
</tr>
<tr>
<th>Total Calls</th>
<td>2.4 million</td>
</tr>
</table>
| Function Name | Calls | Excl. Time | % Time |
|---|---|---|---|
| Drupal\Core\Plugin\Context\ContextDefinition::\_\_sleep | 9,421 | 3.8s | 34.3% |
| GuzzleHttp\Handler\CurlHandler::\_\_invoke | 4 | 880ms | 7.9% |
| Drupal\Core\Entity\ContentEntityStorageBase::setPersistentCache | 138 | 640ms | 5.8% |
| Drupal\Core\Url::toString | 3,129 | 390ms | 3.3% |
### Drupal 9.5.0 ([3327856-16.patch](https://www.drupal.org/project/drupal/issues/3327856#comment-14829464))
<table>
<tr>
<th>Total Time</th>
<td>7.5s</td>
</tr>
<tr>
<th>Total Calls</th>
<td>2.4 million</td>
</tr>
</table>
| Function Name | Calls | Excl. Time | % Time |
|---|---|---|---|
| GuzzleHttp\Handler\CurlHandler::\_\_invoke | 4 | 867ms | 11.4% |
| Drupal\Core\Entity\ContentEntityStorageBase::setPersistentCache | 138 | 665ms | 8.8% |
| Drupal\Core\Url::toString | 3,129 | 370ms | 4.9% |
| Drupal\Core\Entity\Sql\SqlContentEntityStorage::loadFromDedicatedTables | 151 | 366ms | 4.8% |