3 ms·
Thanks for your response. > I also know that I wouldn't pull out a profiler, unless I was experiencing unacceptable performance, which may not happen on my (or
by sunshowers 2y ago
Thanks for your response.
> I also know that I wouldn't pull out a profiler, unless I was experiencing unacceptable performance, which may not happen on my (or the reviewers') end at all.
At some level it doesn't matter in that case, right? We only have a finite amount of time in the world to do things, and if it's fast enough then time is better spent elsewhere.
For a GPU driver, I would imagine that unacceptable performance would be visible quite quickly in p99+ frame times, which the gaming community has figured out are important (they call them "1% lows").
My general philosophy having written Rust for a long time (and before that, C, Python and a bunch of other languages) is to nail correctness first, don't do anything too egregious performance-wise (so try and avoid quadratic or worse algorithms), then worry about performance only to the extent that you can measure average and outlier performance. RAII really, really helps in getting correctness right.
(Rust also helps with performance. Idiomatic Rust tends to be quite fast due to aggressive inlining, especially with PGO.)
> ... which again rings really similar to the memory management story in C (in my head anyways).
I think where I differ is that profilers are a fairly mature and well-understood technology. You can even put profiles of Linux or macOS programs directly into a web browser profiler view, and get a really nice idea of where time is being spent (e.g. [1]). By the way, try out samply or a similar tool some time, it's really easy to use.
I just don't think it's possible to get there with any amount of tooling on top of C, especially with existing codebases -- the language is just not rich enough to support the kinds of annotations required for a sound static analysis ("sound" here means all memory safety bugs are in code not otherwise marked unsafe).
So yes, they look formally similar, but the difference in practice is enormous.
[1] https://github.com/mstange/samply https://github.com/mstange/samply
- cozzyd 2y agoAggressive inlining is exactly what confuses most profilers in my (limited) experience.