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

你知道的性能优化有哪些? #28

Open
Hongbusi opened this issue Jul 5, 2022 · 2 comments
Open

你知道的性能优化有哪些? #28

Hongbusi opened this issue Jul 5, 2022 · 2 comments

Comments

@Hongbusi
Copy link
Member

Hongbusi commented Jul 5, 2022

降低请求量:

  • 合并资源;
  • 减少 HTTP 请求数;
  • minify / gzip 压缩;
  • lazyLoad。

加快请求速度:

  • 预解析 DNS;
  • 减少域名数;
  • 并行加载;
  • CDN 分发。

缓存:

  • HTTP 协议缓存请求;
  • 离线缓存 manifest;
  • 离线数据缓存 localStorage。

渲染:

  • JS/CSS 优化;
  • 加载顺序;
  • 服务端渲染。
@Hongbusi Hongbusi added the today 每日一题。 label Jul 5, 2022
@myltx
Copy link

myltx commented Jul 5, 2022

最近公司项目中优化时使用到的优化

打包方面

-生成环境关闭 productionSourceMapcss sourceMap
拆包
压缩JSCSS、图片
开启Gzip压缩
增加 cache-loader

其他

文件按需加载
使用缓存
图片、路由懒加载

@luckept
Copy link
Member

luckept commented Jul 6, 2022

前端乐观更新:一些交互简单逻辑轻量的功能,比如点赞,可以不等请求结果到达先更新页面,等响应结果到手后再决定是否回滚

@Hongbusi Hongbusi removed the today 每日一题。 label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants