https://www.computerenhance.com/
Ask HN: How can I learn about performance optimization?
71–80 of 153 posts
Re: Ask HN: How can I learn about performance optimization?
#72For several years I have worked primarily with performance optimizations in the context of video games (and previously in the context of surgical simulation). This differs subtly from optimization in certain other areas, so I figured I'd add my own perspective to this already excellent comment section. 1. First and foremost: measure early, measure often. It's been said so often and it still needs repeating. In fact,…
Re: Ask HN: How can I learn about performance optimization?
#73work with steve jobs, or someone like him. > One of the best, if possibly exaggerated, examples of the reality distortion field comes from Jobs's biographer Isaacson. During development of the Macintosh computer in 1984, Jobs asked Larry Kenyon, an engineer, to reduce the Mac boot time by 10 seconds. When Kenyon replied that it was not possible to reduce the time, Jobs asked him, "If it would save a person's life, co…
This feels like a bad ancedote A) kind of sounds like a toxic work environment B) this is a bad way to reason about performance without knowing more. Is this actually a bottleneck? Would the heroic effort be better spent saving minutes elsewhere where its easy to save time instead of saving seconds during boot where its hard to save time and users encounter relatively rarely? Optimizing boot might be the right call b…
Re: Ask HN: How can I learn about performance optimization?
#74Earlier quoted context omitted.
> Note "faster" is not the only thing to optimize for That is very true! I simply think of it first because it is often the biggest problem at my work. One of the extreme exceptions was optimising Wavetale for the Nintendo Switch, where we had to decrease memory usage from over 20GiB to below 3GiB. > is actually a bit unusual as it doesn't represent an exhaustible resource. Not in the context of game development, how…
> Not in the context of game development, however! There you typically don't care about wall time. Instead, you work towards a set frame rate meaning you have a set slice of time (usually 16.7 or 33.3 ms) to go through the entire game and render loop each time. I was about to bring a similar example: Some of our really old daily data processing at work might need some attention and optimization in the future, because…
Re: Ask HN: How can I learn about performance optimization?
#75Measure everything and be extremely critical. Be ready to challenge common and popular held assumptions. Here is something I wrote about extreme performance in JavaScript that is discarded by most programmers because most people that program JavaScript professionally cannot really program. https://github.com/prettydiff/wisdom/blob/master/performance...
For example you create your own bundler, when modern bundlers are very mature and good.
For example you dismiss SSR as unnecessary and then basically roll your own. You dismiss modern frameworks out of hand then list performance improvements they can make for you (e.g. keeping state in html).
Your last two performance improvements are about not taking drugs???
I'm really pro people doing things themselves for fun and all that but this article and you comment comes across as so arrogant and condescending whilst also seeming to show ignorance (or at least willful dismissal) of exactly where modern JavaScript development is at, and present it as state of the art performance improvements.
Re: Ask HN: How can I learn about performance optimization?
#76Things that eat CPU: iterations, string operations. Things that waste CPU: lock contentions in multi-threaded environments, wait states.
You can usually build a lot of the understanding from first principles starting there. Back in the day we had to do this because there wasn't much by way of readily available literature on the subject. Actual techniques will depend or evolve based on your choice of platform or version.
E.g. 20 years ago, we used to create object pools in C++ at load time to avoid Unix heap locks at runtime. This may no longer be necessary. 15(ish?) years ago, JNI was used when the JVM wasn't fast enough for certain stuff. This is no longer necessary. 10 years ago, immutable JS objects were thought to be faster because the JS runtimes at the time were slower to mutate existing objects than to create new ones. This too, may no longer be true (I haven't checked recently). Until very recently, re-rendering with virtual DOM diffing was considered more performant than direct, incremental DOM manipulation. This too, may no longer be true.
Re: Ask HN: How can I learn about performance optimization?
#77Former HFT dev here. Know fundamentals: sources of performance issues = things that eat/waste CPU cycles, things that reach too far down the memory hierarchy. Usually the latter. E.g. L2 cache to RAM - order of magnitude slower; RAM to disk: 4+ orders of magnitude slower. Things that eat CPU: iterations, string operations. Things that waste CPU: lock contentions in multi-threaded environments, wait states. You can us…
“Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.” - Donald E. Knuth, Structured Programming With Go To Statements
Re: Ask HN: How can I learn about performance optimization?
#78As for specific optimizations, it requires context of what software are you trying to optimize and under what circumstances. A lot of the times you are going to see that the answer to asking if certain optimizations are worth the effort is going to be 'it depends'
Re: Ask HN: How can I learn about performance optimization?
#79https://ocw.mit.edu/courses/6-172-performance-engineering-of...
Re: Ask HN: How can I learn about performance optimization?
#80Think of a system as a chain of bottlenecks, visualized as a set of pipes. If you can measure the metric you care about (tput, latency etc) at a component level, and put together the system’s control flow, you can spot where the bottleneck is. Optimise that component, and you will reveal the next bottleneck, now optimize that… and it goes on. To limit the fun of this exercise, it helps to do a back of the envelope calculation of what is a realistic estimate of the thing you measure in the system. Example - I want this service to do 100 emails/ sec. Now, piece by piece remove bottlenecks to achieve close that value.