Explanation of passkeys
Ask HN: How can I learn about performance optimization? | Hacker News
1. First and foremost: measure early, measure often. It's been said so often and it still needs repeating. In fact, the more you know about performance the easier it can be to fall into the trap of not measuring enough. Measuring will show exactly where you need to focus your efforts. It will also tell you without question whether your work has actually lead to an improvement, and to what degree.2. The easiest way to make things go faster is to do less work. Use a more efficient algorithm, refactor code to eliminate unnecessary operations, move repeated work outside of loops. There are many flavours, but very often the biggest performance boosts are gained by simply solving the same problem through fewer instructions.3. Understand the performance characteristics of your system. Is your application CPU bound, GPU compute bound, memory bound? If you don't know this you could make the code ten times as fast without gaining a single ms because the system is still stuck waiting for a memory transfer. On the flip side, if you know your system is busy waiting for memory, perhaps you can move computations to this spot to leverage this free work? This is particularly important in shader optimizations (latency hiding).4. Solve a different problem! You can very often optimize your program by redefining your problem. Perhaps you are using the optimal algorithm for the problem as defined. But what does the end user really need? Often there are very similar but much easier problems which are equivalent for all practical purposes. Sometimes because the complexity lies in special cases which can be avoided or because there's a cheap approximation which gives sufficient accuracy. This happens especially often in graphics programming where the end goal is often to give an impression that you've calculated something.
Things that eat CPU: iterations, string operations. Things that waste CPU: lock contentions in multi-threaded environments, wait states.
Spencer | AI Prod on X: "@rsgnl The DOJ isn't suggesting Apple needs to do something like make sure their service works with other devices or applications. The claim is that Apple is going out of their way to make sure others can't work within their ecosystem. For example, at one point a developer has the same…" / X
The DOJ isn't suggesting Apple needs to do something like make sure their service works with other devices or applications.The claim is that Apple is going out of their way to make sure others can't work within their ecosystem. For example, at one point a developer has the same…— Spencer | AI Prod (@Spshulem) March 21, 2024
Scott Stevenson on Twitter / X