编程与软件工程nnethercote.github.io
Valgrind 的二十年
Twenty years of Valgrind
2022 — 2024,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
Valgrind 作者之一 Nicholas Nethercote 回顾这个动态二进制分析工具二十年来的发展:从 Julian Seward 最初为调试内存错误而写的 Memcheck,到 Cachegrind、Callgrind 等剖析工具的衍生,以及它如何成为开源世界里查找内存错误和性能瓶颈的常备工具。文中也谈及项目的维护、社区与作者个人从中获得的成长。
为什么经久不衰:一个真正改变了无数程序员调试方式的工具,由亲历者讲述它二十年的来龙去脉,既是技术史也是开源协作的范本。
HN 评论精选
Callgrind 帮他定位了按值传递巨型位数组的性能杀手,也改变了他的职业处境。
我职业生涯的一大块几乎要归功于 callgrind。当时我在一家满是博士和资深老手的公司,大家把我看作资历尚浅的新人。我们有个程序性能出了严重问题,没人知道原因,因为项目看起来不复杂,就派我去查。我用当时还很新的 callgrind 和配套的火焰图,发现我们把巨大的位数组按值传递来做寄存器分配——大到一次函数调用几乎把缓存冲干净,而其余代码都以为这些操作很廉价。当时的剖析工具还很原始,程序又是一堆共享库、奇怪的动态分配和 JIT 搅在一起,别的办法都失败后,只有 Valgrind 拿到了剖析数据。我那次汇报和提出的修复方案最终大幅提速,也终于赢得了同事的尊重,之后没有博士学位也不再是问题。后来那些离职的同事还把我招进了下一份工作。
compiler-guy查看英文原文
I sort of owe callgrind a big chunk of my career. I was working at a company full of PhDs and well seasoned veterans, who looked at me as a new kid, kind of underqualified to be working in their tools group. I had been at the firm for a while, and they were nice enough, but didn't really have me down as someone who was going to contribute as anything other than a very junior engineer. We had a severe problem with a program's performance, and no one really had any idea why. And as it was clearly not a sophisticated project, I got assigned to figure something out. I used the then very new callgrind and the accompanying flamegraph, and discovered that we were passing very large bit arrays for register allocation by value. Very, very large. They had started small enough to fit in registers, but over time had grown so large that a function call to manipulate them effectively flushed the cache, and the rest of the code assumed these operations were cheap. Profiling tools at the time were quite primitive, and the application was a morass of shared libraries, weird dynamic allocations and JIT, and a bunch of other crap. Valgrind was able to get the profiles after failing with everything else I could try. The presentation I made on that discovery, and my proposed fixes (which eventually sped everything up greatly), finally earned the respect of my colleagues, and no phd wasn't a big deal after that. Later on, those colleagues who had left the company invited me to my next gig. And the one after that. So thanks!
维护者对陌生贡献者的友善态度令人难忘,团队至今在 CI 中全量跑 Valgrind。
我曾给 valgrind 提交过一个冷门问题的修复。他们要求提供测试用例,我勉强做出来了,但有点发怵,因为一时看不出怎么把它塞进他们的测试套件。Julian Seward 的回复客气到令我从此对陌生人报 bug 都设定了很高的礼貌标准!我们现在仍然在 CI 里把整个测试套件跑在 valgrind 下。了不起的工具!
RustyRussell查看英文原文
I once submitted a bug fix for an obscure issue to valgrind. They asked for a test case, which I managed to provide, but I was a bit nervous as I couldn't immediately see how to fit in their test suite. The response from Julian Seward was so nice it set a permanently high bar for me when random people I don't know report bugs on my projects! We still run our entire testsuite under valgrind in CI. Amazing tool!
调侃作者本身就是剖析工具领域的博士,如今在做 rustc 性能优化。
难怪他优化 Rust 编译器这么厉害——他可是货真价实地拿了个剖析工具的博士学位!
nicoburns查看英文原文
Well damn, no wonder he’s so good at optimising the Rust compiler. He literally has a PhD in profiling tools!
历次讨论
同类还值得读
开源应用架构
The Architecture of Open Source Applications
《开源软件架构》(AOSA)是一本在线免费书,邀请知名开源项目的作者亲自剖析其内部设计,涵盖 SQLAlchemy、LLVM、Audacity、Apache、Bash 等系统。
编程与软件工程上首页 9 次 · 2011–2024aosabook.org编辑精选编程语言简史:简短、不完整且多半错误
A Brief, Incomplete, and Mostly Wrong History of Programming Languages
一篇以戏谑、故意不准确的方式回顾编程语言史的博客文章,用夸张轶事和讽刺定义串起 Lisp、C、C++、Java、JavaScript、PHP 等语言。
编程与软件工程上首页 8 次 · 2009–2021james-iry.blogspot.comSQLite 是如何测试的
How SQLite is tested
SQLite 官方文档页,系统介绍 SQLite 的测试体系:多种测试方法(TCL 测试、模糊测试、回归测试、静态分析等)和海量测试用例,展示了这个小型开源项目如何靠极致测试获得…
编程与软件工程上首页 8 次 · 2009–2025sqlite.org编辑精选高级编程语言(2009)
Advanced programming languages (2009)
Matt Might 的经典文章,按用途推荐“高级编程语言”:如果追求就业就选主流语言,如果追求表达力、学术研究或创业,则推荐 Haskell、OCaml、Scala 等函数式语…
编程与软件工程上首页 8 次 · 2009–2022matt.might.net我的 Forth 与栈机器经历
Yosefk - My history with Forth & stack machines
作者以亲身经历回顾了使用 Forth 语言和栈式机器的历程:既赞叹其简洁优雅、代码量小、可自举的优点,也坦率指出栈操作在实际编程中的痛苦,以及 Forth 社区文化中的问题。
编程与软件工程上首页 8 次 · 2010–2024yosefk.com编辑精选