Skip to content

Speed up loading of the "Users Assigned to Set" page. #2714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

drgrice1
Copy link
Member

@drgrice1 drgrice1 commented Apr 21, 2025

Load all user sets for the given set and all users before rendering the template instead of getting one set at a time in the for loop inside the template. This speeds up loading of this page a lot with a large number of users. With 5000 users it decreases the load time from 3.4 seconds to 0.14 seconds.

Edit: Actually the above timing was when the sets were not assigned to the users. When the sets are assigned to all users it goes from 4.4 down to 0.8 seconds.

@drgrice1 drgrice1 force-pushed the users-assigned-to-set-load-speed-up branch from 679d7c4 to 57e128b Compare April 27, 2025 16:26
@drgrice1 drgrice1 changed the base branch from develop to WeBWorK-2.20 April 29, 2025 12:21
Load all user sets for the given set and all users before rendering the
template instead of getting one set at a time in the for loop inside the
template.  This speeds up loading of this page a lot with a large number
of users.  With 5000 users it decreases the load time from 3.4 seconds
to 0.14 seconds.
@drgrice1 drgrice1 force-pushed the users-assigned-to-set-load-speed-up branch from 57e128b to f2e158a Compare April 29, 2025 20:22
@pstaabp
Copy link
Member

pstaabp commented May 6, 2025

I only noticed a few percent speedup with this. I used your 5000 person course and then loaded the Demo set (from model course). On develop, it took about 73 seconds and with this was about 67 seconds.

The set was not assigned to the users. I was just navigating to the "Users Assigned to Set Demo" page. Is this the wrong place?

@drgrice1
Copy link
Member Author

drgrice1 commented May 6, 2025

That is the correct page. I just tested doing the same thing. I am still seeing a rather noticeable speed up. I takes about 0.14 seconds for the app to render the page with this pull request, and 3.6 seconds with the develop branch. This is after importing the Demo set, but not assigning it to all users.

Since your timings are so large to begin with, I suspect that the main delay you are experiencing is network latency. You are seeing a 6 second decrease in time which is about right and is the improvement from this pull request. The rest is delay in the network.

My tests are done with morbo on the same computer. So there is no network latency. That gives a good measure of direct efficiency of the app in rendering the page. Furthermore, monitoring cpu usage you will see that the load is considerably less with this pull request.

@pstaabp
Copy link
Member

pstaabp commented May 6, 2025

I'm on my laptop--no network at all.

It seems to be when the set is assigned to users. Without assignment, it was about a second of load. (under develop, I got over a minute).

When the set was assigned to all users, it was more than 1 minute on this PR.

@drgrice1
Copy link
Member Author

drgrice1 commented May 6, 2025

I am seeing the same timings that I mentioned before when the set is assigned to all users. More than 4 seconds with develop, and a fraction of a section with this pull request.

This is just for loading the page. Not assigning or unassigning the sets.

@drgrice1
Copy link
Member Author

drgrice1 commented May 6, 2025

For testing here is the classlist: https://github.com/user-attachments/files/19825750/longDemoCourse.lst.txt

Copy link
Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Safari was terrible at rendering the page when the assignment was assigned, but chrome rendered it quite quickly.

@dlglin dlglin merged commit cda2c60 into openwebwork:WeBWorK-2.20 May 6, 2025
2 checks passed
@drgrice1 drgrice1 deleted the users-assigned-to-set-load-speed-up branch May 6, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants