Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Remon’s picture

Status: Active » Needs review
FileSize
2.4 KB
mlncn’s picture

Version: 7.x-dev » 8.x-dev
FileSize
2.05 KB

The previous patch is tested and RTBC after this re-roll for 8 is committed (special thanks to xjm's Drupal 8 core reroll instructions).

scor’s picture

Issue tags: +RDF, +sprint

looks good, waiting for the testbot to finish.

scor’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. RDFx in contrib allows to set namespaces in the database for example, so caching makes sense.

no_commit_credit’s picture

FileSize
1.3 KB
2.05 KB
xjm’s picture

Above fixes the comments to wrap properly before 80 chars. :)

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Seems reasonable, and don't think there's a way to test this really that wouldn't just be testing drupal_static().

Committed and pushed to 8.x and 7.x.

moshe weitzman’s picture

I see no justification here for adding a cache. Whats is slow here? Can't we cache the thing that is slow?

webchick’s picture

Moving back to needs review for discussion.

Moshe, can you please write up some documentation for the Performance gate on when it is/is not acceptable to add static caching? I always get yelled at whenever I commit a patch like this, but I don't understand why. :)

webchick’s picture

Status: Fixed » Needs review
scor’s picture

Core alone won't see any performance benefit because all the namespaces are in code, but it's when used with modules that store namespaces in the database that improvements will be seen. The main reason caching was suggested here is that namespaces are very unlikely to be changing during a given page load, so it doesn't make sense to invoke the namespaces hooks every time namespaces definitions are needed.

Like webchick said, some documentation about the cost of caching would be helpful.

moshe weitzman’s picture

OK, so we put this in in order to babysit slow Contrib processes. Thats not the job of core. If a module can't return namespaces quickly, then *it* should cache, not core.

We don't add static caches every time we see a function getting called twice (or more). It has to be called multiple times *and* be slow. If it can sometimes be slow, we should cache as close to the slowness as possible.

The cost of caching is a decay in developer and admin experience. One now has to add resets and remember to add resets when related data changes. In general, invalidating cache at right time is a huge headache, and thats why we should resist adding static (and persistent) caches except when really needed.

I'll try to blog about this topic soon.

scor’s picture

Status: Needs review » Reviewed & tested by the community

point taken. let's revert this patch then please.

moshe weitzman’s picture

Added docs to performance gate.

webchick’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

Awesome, thanks Moshe! :)

Reverted this patch from D8 and D7. And I guess that makes this "won't fix"?

scor’s picture

thanks webchick. yeah we'll add the cache in contrib directly.

cweagans’s picture

Issue tags: +Needs backport to D7