Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Comment | File | Size | Author |
---|---|---|---|
#5 | 1089040-5.patch | 2.05 KB | no_commit_credit |
#5 | interdiff.txt | 1.3 KB | no_commit_credit |
#2 | drupal_static-rdf_namespaces-1089040-8x-reroll.patch | 2.05 KB | mlncn |
#1 | drupal_static-rdf_namespaces-1089040.patch | 2.4 KB | Remon |
Comments
Comment #1
Remon CreditAttribution: Remon commentedComment #2
mlncn CreditAttribution: mlncn commentedThe previous patch is tested and RTBC after this re-roll for 8 is committed (special thanks to xjm's Drupal 8 core reroll instructions).
Comment #3
scor CreditAttribution: scor commentedlooks good, waiting for the testbot to finish.
Comment #4
scor CreditAttribution: scor commentedLooks good. RDFx in contrib allows to set namespaces in the database for example, so caching makes sense.
Comment #5
no_commit_credit CreditAttribution: no_commit_credit commentedComment #6
xjmAbove fixes the comments to wrap properly before 80 chars. :)
Comment #7
webchickSeems 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.
Comment #8
moshe weitzman CreditAttribution: moshe weitzman commentedI see no justification here for adding a cache. Whats is slow here? Can't we cache the thing that is slow?
Comment #9
webchickMoving 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. :)
Comment #10
webchickComment #11
scor CreditAttribution: scor commentedCore 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.
Comment #12
moshe weitzman CreditAttribution: moshe weitzman commentedOK, 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.
Comment #13
scor CreditAttribution: scor commentedpoint taken. let's revert this patch then please.
Comment #14
moshe weitzman CreditAttribution: moshe weitzman commentedAdded docs to performance gate.
Comment #15
webchickAwesome, thanks Moshe! :)
Reverted this patch from D8 and D7. And I guess that makes this "won't fix"?
Comment #16
scor CreditAttribution: scor commentedthanks webchick. yeah we'll add the cache in contrib directly.
Comment #17
cweagansUpdating tags per http://drupal.org/node/1517250