Home  >  Q&A  >  body text

angular.js - AngularJS制作的网页怎么提高访问速度?

  1. AngularJS在访问的时候要加载诸多的js文件,如果手机网速不快,那么可能要加载好久。
  2. 提高后台的响应速度,不知为何100Mps的阿里云,我用python的flask写后台api,有时候一个请求要十几秒。。。
  3. 其他可以提高访问速度,节省用户流量的方式

以上几点,本人菜鸟,只是略微有些了解,比如不要第一次加载所有js文件等等,希望有高手能给出一点更具体的实施的措施,十分感谢!

滿天的星座滿天的星座2735 days ago613

reply all(6)I'll reply

  • 为情所困

    为情所困2017-05-15 16:58:04

    1. Compress all JS file dependencies that need to be used.
    2. Loading on demand means loading which JS files you need to depend on.
    3. Use a CDN.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-15 16:58:04

    Data caching, compression and merging code

    Compared to react, angular is really slow to load for the first time. There is no way, react can decide when to load based on the life cycle.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-15 16:58:04

    The main ones are
    1. Asynchronous loading
    2. Loading on demand
    3. Data caching (local caching of static resources that are not frequently updated, ajax request caching)
    4. Adding loading to improve user experience
    5.CND
    6. Compression merge.
    If the client wants to accelerate, it should focus on file size, request time, code execution efficiency, and mobile terminals should also pay attention to issues such as using canvas for hardware acceleration of images, css layout, etc., which will also affect efficiency, page rendering, etc.

    reply
    0
  • 黄舟

    黄舟2017-05-15 16:58:04

    For the first time js is loaded, it will be loaded synchronously. If it is not required for the homepage, it can be loaded asynchronously

    reply
    0
  • 高洛峰

    高洛峰2017-05-15 16:58:04

    Compress and merge js and css into two files, apply for a free oss on Alibaba, and upload the files.

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-15 16:58:04

    Click f12 on Chrome or ff to see the entire loading process
    1. How many files are loaded, how many static and how many dynamic? 2. Are there any special abnormalities in each static loading step and each dynamic step? 3. Consider dns resolution and cache usage , whether there are any abnormalities in the delay from request to response, the transmission process, and the large inactivity time during the loading process
    In addition, whether the line between your network and the server is stable

    reply
    0
  • Cancelreply