The website system opens the home page and takes up too much memory.

the website version of the background management system developed by the company, using webpack+angularJS technology, now encountered a situation, that is, just opening the landing page, it takes up fast 300m of memory. I would like to ask, you gods, have you ever encountered this kind of situation? How did you solve it?

Mar.06,2021

o (opening-loading) o, it should be very slow to open the home page, how to improve the loading speed of the first screen.

  1. routing lazy loading;
  2. static files such as pictures are compressed and cloud storage is used.
  3. Common modules are introduced on demand, using cdn;
  4. .

300m!

Open the chrome debugger to see where the bottleneck is, perhaps reading a static resource that should not have been loaded.

as I said upstairs, lazy loading may be the most helpful.


300m of memory should not have much to do with the size of the resource load. If you use wepback to package, the maximum minify is only about a few megabytes. Add some images and third-party libraries, and 10m is enough. And you did not describe the phenomenon of taking up memory, it is a white screen? Or Catton? Or is it just found to be high through memory monitoring?

I think that since we are using ng1, it takes up too much memory and tries to reduce unnecessary watcher in the code to improve performance. Generally speaking, we start from these aspects

.
  • reduce the use of bi-directional binding (ignore ng1.2 below) = , and use more unidirectional binding
  • reduce the use of the $compile instruction
  • reduce the use of the $apply instruction (if there are multiple repeated $apply attempts to merge into one)
  • try not to do some intensive operations in ngCheck

other aspects to see if there are any redrawing and rearrangement caused by too many special effects on css, that's about it.

if there are any mistakes, please correct them.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea032b-1aba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea032b-1aba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?