Why does simple website crash on mobile (iOS Safari and Chrome, at least)?

后端 未结 7 1393
深忆病人
深忆病人 2021-01-30 18:42

I have a website that is very simple, but very long -- a lot of text that could be scrolled through. It\'s a documentation site, and considering the nature of the content (a lot

7条回答
  •  有刺的猬
    2021-01-30 19:19

    I ran an audit with Chrome on the site. It suggested this:

    Remove unused CSS rules (44)
    44 rules (10%) of CSS not used by the current page.
    css-built.min.css: 10% is not used by the current page.

    
        audio, canvas, video  
        audio:not([controls])  
        [hidden]  
        abbr[title]  
        dfn  
        hr  
        mark  
        q  
        sub, sup  
        sup  
        sub  
        svg:not(:root)  
        figure  
        fieldset  
        legend  
        button[disabled], html input[disabled]  
        input[type=checkbox], input[type=radio]  
        input[type=search]  
        input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration  
        textarea  
        table  
        .older-docs  
        .older-docs>li  
        .older-docs>li:not(:last-child):after  
        *, :before, :after  
        fieldset  
        textarea  
        :not(pre)>code[class*=language-], pre[class*=language-]  
        :not(pre)>code[class*=language-]  
        .namespace  
        .token.regex, .token.important  
        .token.important  
        .older-docs  
        .changelog dt  
        .changelog>dt  
        .changelog>dt:after  
        .changelog>dd  
        .changelog-i-list  
        :target>.entry-body  
        .sub--h  
        .example--css.is-active  
        .preload .help-content-c  
        .help-content-c.is-active  
        .help-content.is-active  
    
    

    The task manager on Chrome shows that the page takes up about 2x as much total memory than other sites, such as stackoverflow and dropbox. I would recommend dividing up the features into separate pages instead of one long page. By separating the features it would improve the server's efficiency and the browser's load time and memory usage. There would be less JavaScript and CSS running on each page and smaller amounts of data would be sent from the server. Having all the features on the home page is inefficient. For example, if a user only needed to look up how to make a Font Icon Label they would have to load other sections of the page that are not needed and take up memory.

提交回复
热议问题