Problem/Motivation
This is a follow up to #1203766: With large number of permissions /admin/people/permissions becomes unusable, which was committed to both Drupal 7 and Drupal 8 in 2011. It was later re-opened to make further improvements. This is moving that improvement work to a new issue. If you want to read that issue it was re-opened in #1203766-25: With large number of permissions /admin/people/permissions becomes unusable
With a large number of permissions the permission page takes a long time to load.
Steps to reproduce
TBA
Proposed resolution
TBD
Remaining tasks
Discuss
Patch
Review
User interface changes
TBD
API changes
TBD
Data model changes
TBD
Release notes snippet
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | drupal-user-permissions-js-3244564-20.patch | 6.69 KB | mabho |
| drupal.user-permissions-js.47.patch | 3.89 KB | quietone |
Comments
Comment #6
quietone commentedThe upload patch is the latest one from the original issue, #47. It was made in Dec 2011.
Added credit from the other issue, but still learning that so it would be prudent for others to check that.
Comment #7
nod_Comment #8
quietone commented@nod_, thanks for the reminder about tags. Adding the performance tag that was in the original issue
Comment #9
droplet commentedI have very low interest in it because I can deal with this problem smartly personally.
For those who are interested, I think you need to figure out the root problem first. Browser? CPU? jQuery? Drupal Code? or Plain JS?
Obviously, this has a basic rendering problem, so you need to wait.
For 40,000 elements,
to query one element taken 15ms
to get all values taken 48ms
IMO, this is very acceptable.
** Oh. You can't test above snippet in Firefox. There's a browser bug in Firefox under above heavy load or something I missed. But Firefox rendered much faster than Chrome when you output HTML rather than use JS above
Comment #10
catchThere's a patch here so marking for review.
Comment #11
droplet commentedThe patch is outdated. No matter code format or code logic.
and a bug:
#3244737: "core/drupal.checkbox" (misc/checkbox.js) has never loaded on user permission page
What blocking server-side doing the Permission update when "AUTHENTICATED USER" is checked? It reduced a lot of extra dummy checkboxes and need not call toggle on page loading.
Don't it a UX problem?
If "AUTHENTICATED" is checked (on page load, load from DB), we see all checkboxes are checked.
Now, unchecked "AUTHENTICATED", only some is still checked. I expected all still checked.
Comment #15
smustgrave commentedMoving to NW as mentioned the patch is outdated.
Not sure if this is postponed by https://www.drupal.org/project/drupal/issues/3244737
Comment #17
mohammed motar commentedDoes anyone have any idea on how to increase the performance of the permissions page?
When I try to access the permissions page I get:
Got error 'PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20728968 bytes) in /var/www/drupal/vendor/twig/twig/src/Template.php on line 388'.
Comment #18
mabho commentedI wonder if we can approach the problem raised here using Intersection Observer... It seems like the best approach... I am suffering from a huge lag on 15 roles loading in parallel.
Comment #19
mabho commentedThe patch on this thread can't be applied anymore because of the changes introduced here #3278415: Remove usages of the JavaScript ES6 build step, the build step itself, and associated dev dependencies.
Comment #20
mabho commentedOk, here is a suggested patch using
IntersectionObserver. The previous approach was:Although detaching/re-inserting is probably an improvement over the previous version, it still causes considerable lag when loading the permissions page in the context of multiple roles and modules, where literally thousands of checkboxes are manipulated by the script.
This new approach I am suggesting is dropping the detach/re-attach method. Instead, the new code will only kick in when necessary by using
IntersectionObserver; we will do the bare minimum to make sure the expected results are still delivered; here is an overview of what is being delivered:Authenticated usercolumnIntersectionObserverto each one of these rows, and then process them individually as they become visible on the page.I ran some local tests with
console.time()andconsole.timeEnd()applied to the beginning and end of script and the performance gain was massive.Comment #21
nicxvan commentedNew child issue to address just the JS side #3464530: Improve performance of the user.permissions.js script running in /admin/people/permissions.
Comment #22
mabho commentedI got some feedback on the Drupal Slack channel from some Drupal community colleagues who thought my proposed resolution would suit better in a new, separate ticket. I have thus created an issue here (#3464530: Improve performance of the user.permissions.js script running in /admin/people/permissions.) with a new merge request carrying some improvements over the patch file posted on this issue queue. Edit: I just saw the comment recently posted by @nicxvan about the new issue queue.
Comment #23
nod_Patch in the related issue cut the number checkboxes by ~60% that will help across the board.
Porting credit