Bruce Dawson, a Chrome engineer, writes about Windows performance debugging, floating-point math, and CPU and OS bugs he has tracked down.
Commenters call it an excellent resource on obscure native code and platform details, and point to it for learning Windows Performance Analyzer.
It clearly didn’t come out of game dev. Many people doing high performance work on either embedded or “big silicon” (amd64) in that era were fully aware of the importance of locality, branch prediction, etc
But game dev, in particular Mike Acton, did an amazing job of making it more broadly known. His CppCon talk from 2014 [0] is IMO one of the most digestible ways to start thinking about performance in high throughput systems.
In terms of heroes, I’d place Mike Acton, Fabian Giesen [1], and Bruce Dawson [2] at the top of the list. All solid performance-oriented people who’ve taken real time to explain how they think and how you can think that way as well.
I miss being able to listen in on gamedev Twitter circa 2013 before all hell broke loose.
[0] https://youtu.be/rX0ItVEVjHc?si=v8QJfAl9dPjeL6BI
[1] https://fgiesen.wordpress.com/
[2] https://randomascii.wordpress.com/
There's a great Random ASCII blog post about an obscure FPU issue like this [1].
- The crash was in a FPU that Chrome barely uses - The instruction that crashed Chrome was thousands of instructions away from the one that triggered the exception - The instruction that triggered the exception was not at fault - The crash only happened because of third-party code running inside of Chrome - The crash was ultimately found to be caused by a code-gen bug in Visual Studio 2015 I've run into this kind of thing once myself (sharing a process with other companies is fun!). It was real confusing to get a stack trace showing our code suddenly crashing on a line of code that was doing the exact same thing with the exact same values as it had always done before.
[1]: https://randomascii.wordpress.com/2016/09/16/everything-old-is-new-again-and-a-compiler-bug/
The browser isn't exposing it to websites. It's simply due to the fact of playing media that it's lowering the minimum timer resolution on Windows. In the past it would also do this when just scrolling among other things if I remember correctly, I'm not sure if it still does this.
Firefox uses a different method that doesn't require lowering the minimum timer resolution.
Either way the global behavior of this is no longer true on modern Windows 10/11 machines (as of Windows 10 2004) as each process must now call timeBeginPeriod if it wants increased timer resolution: https://randomascii.wordpress.com/2020/10/04/windows-timer-resolution-the-great-rule-change/
https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod
I don't think that is true. If they had that many developers burning down performance issues then bugs like this would (IMHO) be getting fixed earlier. Anecdotally it sounds like a lot of customers are hitting this bug and I'd love to know whether it is known, being investigated, or just noticed now.
I'm sure it has been showing up in their start-menu telemetry.
I also wonder why they haven't fixed this issue:
https://twitter.com/BruceDawson0xB/status/1607163439159611392t
And why this was ever allowed to ship:
https://randomascii.wordpress.com/2022/09/29/why-modern-software-is-slow-windows-voice-recorder/
And why this was ever allowed to ship:
https://randomascii.wordpress.com/2022/07/11/slower-memory-zeroing-through-parallelism/
The actual rules are very complicated. C allows greater precision for intermediate results but compilers are sometimes careful to stick to IEEE rounding. [1] contains a good general overview, and [2] talks about FMA in particular. And in [3] I've set up a Godbolt example to play with. By default -O3 gives you FMA, but -O or -O3 with -ffp-contract=off don't. So you absolutely can get different results depending on optimization levels.
[1]: https://randomascii.wordpress.com/2012/03/21/intermediate-floating-point-precision/
[2]: https://kristerw.github.io/2021/11/09/fp-contract/
[3]: https://godbolt.org/z/eTz8o6b3P
Please don't compute speed-up like that.
Old time: 6 minutes (360 seconds).
New time: 1 minute and 50 seconds (110 seconds).
Speed-up calculated by article author: 1-110/360=0.694 (69.4% saved).
Speed-up calculated by me: 360/110=3.27 (3 times faster).
Please calculate it the other way around. It makes great difference when you say you made something 10× faster than when you say you saved 90% of work even if both mean exactly the same thing.
Bruce Dawson has great article about this: https://randomascii.wordpress.com/2018/02/04/what-we-talk-about-when-we-talk-about-performance/