Open waynew99 opened 2 years ago
I'd like to talk about the multi-threading option! How difficult to implement? Would there be other consequences besides displaying "running simulation?"
It should be doable! The idea is to run the calculation on a separate thread from the UI, so that the UI does not have to wait for the calculation to complete, ensuring its responsiveness. I can't think of any other consequences at the moment. I will proceed to experiment on one of the modules for a proof-of-concept, and will update here any problems I discover along the way.
Yeah experimenting with that sounds like a great idea!
Some progress update! I did some experimenting and found the solution to part of the problem. I thought calculating the sampling simulation many times was the bottle-necking part of the page – it turned out that the calculation was only part of the bottleneck.
I was able to move the calculation to a background "web worker" and keep the page responsive. However, when the calculation finishes and we try to update the highchart with the calculated result, the page freezes like before. I've yet to find a solution, but will keep working on it.
The progress can be viewed on the branch performanceImprovement
.
Thanks! Go ahead and keep pondering, but it may turn out to be a difficult problem to solve.
I've fixed highchart and datatable update issue, and built a circular progress bar indicating the progress. After applying the following changes to Central Limit Theorem, we can now run up to 1 million replications. When running more than 1 million replications, while the page is still alive and functioning, its performance starts to decrease a lot but . If possible, we might consider cap the max number of replications somewhere around 1 million.
Methods taken so far to increase performance:
ScatterPlot
, sacrificing some visual rendering and utilizing GPU for faster loading.DataTableDynamicLoad
that uses another package to "dynamically load" the rows that are on the screen, avoiding unnecessary rendering of all rows up front.Amazing! Before proceeding, I want to make sure that the web worker does not interfere with deployment. Many moons ago, my husband and I figured out that users could not see updates to our website if they had ever viewed it, because a service worker stored the old version of the website. I want to make sure that this is not the case here. If it deploys well, then fantastic!
Hi Wayne, thanks for the update. Do you have a new version for me to test drive? What would need to happen before we deploy?
I think it's ready to be deployed! Unfortunately, I can't think of a good way to test the web worker's caching situation that you mentioned separately before deployment. I guess we can first deploy and see if problems occur in the production environment.
Okay awesome! Let's go ahead and get it ready for deployment and see how it goes tonight. To know whether it worked, you can insert some small change on the front page, like maybe at the bottom you can have a version date or something?
Sure! I added this footer to the front page.
Cool, great. That's how we'll know if it changes.
Amanda G. Gregg Associate Professor of Economics, Middlebury College Join My Personal Zoom Roomhttps://middlebury.zoom.us/my/agregg?pwd=OWlGMmZMSWJaUkowRG5DUWJtRm9CQT09 (Password: EconHist) Office: Farrell House 101 Office Phone: (802) 443 - 3419 Pronouns: she/her/hers
From: Wayne Wang @.> Sent: Tuesday, August 2, 2022 1:56 PM To: ProfessorAmanda/econsimulations @.> Cc: Gregg, Amanda G. @.>; Assign @.> Subject: Re: [ProfessorAmanda/econsimulations] Performance Improvement: multiple modules (Issue #298)
Sure! I added this footer to the front page.
— Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FProfessorAmanda%2Feconsimulations%2Fissues%2F298%23issuecomment-1203042507&data=05%7C01%7Cagregg%40middlebury.edu%7C742a0d2d6e464a2666c108da74b04b5c%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637950597772849984%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=xws10B8MGp0TttVRsR3aWkpDpzGyTXGN0KGX2puzlpQ%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMWGM7E5TNS75GDABCWGNKDVXFOL5ANCNFSM53BUNQVQ&data=05%7C01%7Cagregg%40middlebury.edu%7C742a0d2d6e464a2666c108da74b04b5c%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637950597772849984%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=LQypfgJ2edzHYKrtGhi72hxhYSRzdp2Z1okMHGRoCRU%3D&reserved=0. You are receiving this because you were assigned.Message ID: @.***>
When the user enters a large number (on the scale of at least 10000) in the field "Number of Replications" trying to run a simulation multiple times, the site becomes unresponsive due to too large amount of computation happening on the user's CPU.
Modules affected:
Potential Solutions: