From #1683644-141: Use Annotations for plugin discovery:

With no caching my apache server cpu goes totally nuts on http://localhost/drupal8/admin/structure/views and related pages.
My pretty unoffical benchmark technique (aka look-at-your-watch-and-count-seconds method) messures 15+ seconds on my non optimized xamp setup.

Ow its a views problem:
Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery->getDefinitions()
gets called 104 times :)

Comments

dawehner’s picture

aspilicious added a CacheDecorator which will fix these problems already, but this will lead to N cache()->get calls, one for each plugin type
so something > 10 per executed view.

I'm wondering whether it would be worth to introduce a cache decorator which stores the information of all plugin types defined by views.

aspilicious’s picture

A gloabal "cache decorator" is only possible if you define a common object that does the following:

1) When there is no static cache ==> load all the type defintions ==> save defintions in db (keyed by type) ==> get the needed definition
2) When cache is not empty ==> just get the needed information.

If we put this inside the injection container we can use a protected variable to store the definitions. WIN!
But you should be carefull with multilingual stuff...

Thats maybe a reason not to do this...

ps: performance issues are almost fixed.
#1722882: Plugin CacheDecorator caches globally, ignores request context, and does not specify tags for cache items
http://drupalcode.org/sandbox/damiankloip/1685040.git/commitdiff/9f9d2b0...

dawehner’s picture

We could wait until the issue in #1722882: Plugin CacheDecorator caches globally, ignores request context, and does not specify tags for cache items shows us how the translation mechanism will work
and implement the CacheMultipleDecorator based on that, what do you think?

aspilicious’s picture

yeah good idea

dawehner’s picture

The cache decorator is in, i believe we can postpone this issue and maybe open it before release?
I think before implementing anything we should really check whether this is actually a performance issue on a real site
as this cache will probably never be cleared on normal runtime.

aspilicious’s picture

In fact I don't think it's a performance issue anymore. Maybe we should rename the issue to reflect we are thinking about a global cache.

tim.plunkett’s picture

Status: Active » Fixed

Per #5/#6, closing this.

Automatically closed -- issue fixed for 2 weeks with no activity.