go语言·青训营笔记

39 阅读1分钟

这是我参与「第五届青训营 」伴学笔记创作活动的第 5天 追求性能

性能优化 提升软件系统的处理能力,减少不必要的消耗,充分发觉计算机算力。

为什么要做性能优化? 1.用户体验: 带来用户体验的提升, 2.资源高效利用: 减低成本,提高效率。

CleanShot 2023-01-18 at 11.59.32@2x.png

优化的层面 业务代码、SDK、基础库、语言运行时、OS CleanShot 2023-01-18 at 12.00.28@2x.png

CleanShot 2023-01-18 at 12.02.12@2x.png 业务层优化: 针对特定场景,具体问题,具体分析 容易获得较大性能收益 语言运行时优化 解决更通用的性能问题 考虑更多场景 Tradeoffs 数据驱动 自动化性能分析工具--pprof 依靠数据而非猜测 首先优化最大瓶颈

性能优化与代码质量 goSDK CleanShot 2023-01-18 at 12.03.07@2x.png 自动内存管理

CleanShot 2023-01-18 at 12.07.14@2x.png

CleanShot 2023-01-18 at 12.09.30@2x.png

CleanShot 2023-01-18 at 12.11.53@2x.png

CleanShot 2023-01-18 at 12.15.34@2x.png

CleanShot 2023-01-18 at 12.16.24@2x.png

CleanShot 2023-01-18 at 12.17.46@2x.png

CleanShot 2023-01-18 at 12.19.08@2x.png 内存分配--分块

CleanShot 2023-01-18 at 12.23.45@2x.png

CleanShot 2023-01-18 at 12.36.05@2x.png

CleanShot 2023-01-18 at 12.39.26@2x.png

CleanShot 2023-01-18 at 12.45.51@2x.png

CleanShot 2023-01-18 at 12.47.56@2x.png

CleanShot 2023-01-18 at 12.49.12@2x.png