Skip to content
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

前端性能优化那些事 #33

Open
wuxianqiang opened this issue Jan 9, 2018 · 0 comments
Open

前端性能优化那些事 #33

wuxianqiang opened this issue Jan 9, 2018 · 0 comments
Labels

Comments

@wuxianqiang
Copy link
Owner

  1. 减少http请求次数:CSS Sprites, JS、CSS 源码压缩、图片大小控制合适;网页 Gzip,CDN 托管,data 缓存 ,图片服务器

  2. 前端模板 JS + 数据,减少由于HTML标签导致的带宽浪费,前端用变量保存 AJAX 请求结果,每次操作本地变量,不用请求,减少请求次数

  3. 用 innerHTML 代替 DOM 操作,减少 DOM 操作次数,优化 javascript 性能

  4. 当需要设置的样式很多时设置 className 而不是直接操作 style

  5. 少用全局变量、缓存DOM节点查找的结果。减少 IO 读取操作

  6. 避免使用 CSS Expression(css表达式)又称 Dynamic properties(动态属性)

  7. 图片预加载,将样式表放在顶部,将脚本放在底部,加上时间戳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant