- First commit to issue fork.
- last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - Status changed to Needs review
over 1 year ago 3:24am 29 June 2023 - π©πͺGermany donquixote
I was suggesting earlier to make a constant for
['form' => [], 'display' => []]
.
But actually it would be pointless, there is nothing wrong with repeating a simple literal array like this.We could go crazy with the ??= but I think people won't like it, so I don't :)
public function getExtraFields($entity_type_id, $bundle) { return ($this->extraFields ??= $this->loadExtraFields())[$entity_type_id][$bundle] ?? [ 'form' => [], 'display' => [], ]; }
- last update
over 1 year ago 29,563 pass - πΊπΈUnited States mglaman WI, USA
Is there a way to get a Blackfire or Xhprof profile of a before/after to see the improvements?
- π©πͺGermany donquixote
Is there a way to get a Blackfire or Xhprof profile of a before/after to see the improvements?
Even if we do, it is very project-specific.
It depends on the product of:
- Duration of discovering all extra fields, TIMES
- Number of entity bundles for which extra fields are requested.On a project I am working on, that includes opensocial, the second factor was 171.
The MR would reduce this to 1.More numbers later.
- π©πͺGermany donquixote
Steps to reproduce:
Preparation:
- Install Drupal with OpenSocial distro as in
https://www.drupal.org/docs/drupal-distributions/open-social/installing-... β
. Make it available at
http://opensocial.localhost
. - Enable layout_builder module.
(If I just use core + layout_builder, I don't get enough significant difference)
Repeatable steps, thanks to https://stackoverflow.com/a/22625150/246724
time ./vendor/bin/drush cr; curl -w @- -o /dev/null -s "http://opensocial.localhost/" <<'EOF' time_namelookup: %{time_namelookup}\n time_connect: %{time_connect}\n time_appconnect: %{time_appconnect}\n time_pretransfer: %{time_pretransfer}\n time_redirect: %{time_redirect}\n time_starttransfer: %{time_starttransfer}\n ----------\n time_total: %{time_total}\n EOF
I get repeatedly:
Without the fix: time_total: ~6.7 seconds
With the fix: time_total: ~2.7 secondsWhy this scenario?
OpenSocial distro gives us a bunch of extra fields.
Layout builder gives us ExtraFieldBlockDeriver::getDerivativeDefinitions(), which requests all extra fields from all bundles at once.
Without this, the performance penalty would be distributed across different requests and harder to measure. - Install Drupal with OpenSocial distro as in
https://www.drupal.org/docs/drupal-distributions/open-social/installing-... β
. Make it available at
- π©πͺGermany donquixote
The original profiling I did with xdebug, but this is too much to post here.
Just for reference, on the original project I profiled, the cachegrind.out.* file without the fix was ~3.5GB, without it was more like 700MB.
- π©πͺGermany donquixote
The patches are no longer relevant, I would say.
- last update
over 1 year ago 29,827 pass - Status changed to RTBC
over 1 year ago 2:27pm 31 July 2023 - πΊπΈUnited States smustgrave
Appears all threads have been resolved so going to mark it
- last update
over 1 year ago 29,911 pass - Status changed to Fixed
over 1 year ago 9:21am 1 August 2023 - π¬π§United Kingdom catch
I second guessed this one due to the cache entry size potentially being much larger than the individual ones, but then convinced myself that's not a real problem - in general we're dealing with a handful at most of extra fields per entity type.
Committed/pushed to 11.x and cherry-picked to 10.1.x, thanks!
Automatically closed - issue fixed for 2 weeks with no activity.