推荐sitkack · 2025-01
“If you enjoy the science of injecting slowness to determine which component has the largest impact on performance, you would enjoy this work by Emery Berger.”
推荐这项工作,适合喜欢用注入慢速判断组件性能影响的人
因果剖析:通过虚拟加速代码,找出真正影响性能的代码行
传统性能剖析器只告诉你时间花在哪,但优化那段代码未必能提速。这篇论文提出因果剖析(causal profiling):在程序运行时做性能实验,通过让其他并发代码暂停来“虚拟加速”某段代码,从而量化优化它的潜在收益。基于此实现的 Coz 在 Memcached、SQLite 和 PARSEC 上发现了新的优化机会,Memcached 提速 9%、SQLite 提速 25%,多数情况只需改动不到 10 行代码。
评论者既推荐“注入减速来测各部分对性能影响”这一思路,也引用它在 SQLite、memcached 上的提升,另有人批评因果剖析在实践中用处有限。
“If you enjoy the science of injecting slowness to determine which component has the largest impact on performance, you would enjoy this work by Emery Berger.”
“Even something like a causal profiler[2][3][4], which attempts to control for the volatile aspects of performance, is of limited use”
“However, better tooling still managed to locate 25% of performance improvement[2] & even 9% in memcached.”