Skip to content

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

Open

Description

@Hongbusi

降低请求量:

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

加快请求速度:

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

缓存:

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

渲染:

  • JS/CSS 优化;
  • 加载顺序;
  • 服务端渲染。

Activity

  1. myltx commented on Jul 5, 2022

    @myltx

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

    打包方面

    -生成环境关闭 productionSourceMap、css sourceMap
    拆包
    压缩JS 、CSS、图片
    开启Gzip压缩
    增加 cache-loader

    其他

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

  2. luckept commented on Jul 6, 2022

    @luckept
    Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions