Live data from Hacker News

Ask HN: How can I learn about performance optimization?

news.ycombinator.com

91–100 of 153 posts

Re: Ask HN: How can I learn about performance optimization?

#91
Many have covered specific learning material, but my best advice is to find a mentor. It really is a skill that's best learned by apprenticing. I new a lot of concepts and could muddle my way through them, but it wasn't until I had experienced people to work under directly that my skills really took off.

Just like the best advice on learning to write code is to write code, the best way to learn how to optimize performance is to optimize performance.

Re: Ask HN: How can I learn about performance optimization?

#92

Measure 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...

These are good performance improvements, but they clearly come at a cost. Race cars are faster than sedans, but the tires fall off and they explode without a team of engineers supporting them. The best people I can hire can mostly use a computer. They can’t build something like this, or even build upon it. They need recipes to reuse to accomplish tasks, and the more something is custom, the harder it is to teach. And…

As someone who wrote JavaScript professionally for 15 years, but no longer, the greatest problem with that line of work is poor preparation. Hoping a collection of frameworks fills that gap without human intervention isn’t working. Most people doing this professionally have absolutely no idea how any of these technologies work. Being able to read and turn on a monitor presents an exceptionally low baseline considering the level of compensation.

Most people capable of writing original software can easily apply the things I suggest, but most people writing JavaScript are not capable of writing original software. That doesn’t mean guidance for superior performance is out of alignment. It means there are fundamental problems with hiring and training.

Using your example I once saw a Puerto Rican racing team make a lot of money with their custom car. They took an old 80s Mazda small sedan and dropped in a large Ferrari engine and customized the suspension. This is something innovative they did to make money by winning competitions, because that pays better than just changing tires. Shops that only change tires or change oil have that does to a science to maximize human productivity, akin to copy/paste.

Re: Ask HN: How can I learn about performance optimization?

#93
Casey Muratori did many lectures. Check out his yt page playlist. Start with the one titled software quality https://www.youtube.com/@MollyRocket/playlists

I heard good things about his course https://www.computerenhance.com/

Agner Fog manuals are good too https://www.agner.org/optimize/#manuals

A site to look up instruction timings is https://uops.info/table.html

Re: Ask HN: How can I learn about performance optimization?

#94

Earlier quoted context omitted.

If you can run the daily batch processing in parallel, can't you have one batch start at T+0, the next one starts at T+24h, then the first one finishes at T+28h and so on?

That leads to an infinite backlog no ? If you need more than 24h to process 24h of data ?

That may depend on the context and data but you may end the first job at T+28 (runtime of 28 hours) and the second at T+52 (28 hours as well, started at T+24).

If jobs must be executed one after another, then you absolutely create an infinite backlog.

Re: Ask HN: How can I learn about performance optimization?

#95
post #52
post #49

Agner Fog’s optimization manuals are pretty good https://www.agner.org/optimize/

Definitely still useful, but some info, esp on some C++ things, is already outdated or even wrong. But still a good resource if approached with "trust but verify" mindset

Excellent point.

To be honest I've not approached the material in a few years. Can you pinpoint which areas are wrong?

Re: Ask HN: How can I learn about performance optimization?

#96
post #76

Former 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…

Do you guys still buy the beefiest Intel Xeons in order to fit your main application + OS entirely within the L3 cache? There was a CppCon talk from a HFT dev about this 10 years ago.

Re: Ask HN: How can I learn about performance optimization?

#97
The Nike doctrine works: just do it. Besides that I recommend always ask yourself the question: we told the computer to do X, and it took too long, so what was it doing for that time? The rough answer can come from surprisingly simple sources such as "top". Fancy, intrusive tools such as traditional profilers are often not the best first place to look for answers. If X is some short one-off thing that makes it hard to see what's happening: make it do 1M of X so bulk data can be observed.

Re: Ask HN: How can I learn about performance optimization?

#98
Performance optimization is very simple. Make computer do less to get same or similar result. The most performant application does very little and still gets you the result you need.

To do this you must find ways to “cheat”. This can be of various forms. Better algorithms, better data structures, precomputation, caching. At some point you will exhaust low hanging fruit and need to dig into lower level aspects of the code or its compilation.

Anyway, best way to learn is to do it, go depth first and always check your work thoroughly. (It is easy to optimize yourself into a solution that is not working properly).

Re: Ask HN: How can I learn about performance optimization?

#99
1. Computer Enhance by Casey Muratori (check out some of his YouTube videos if you want a preview)

2. Read the blog posts people wrote about the 1BR challenge where they tried to figure out the fastest way to process 1 billion rows of data

3. Brendan Gregg‘s blog

4. Google/YouTube how to profile code in your desired language

Re: Ask HN: How can I learn about performance optimization?

#100
Here's 2 more links. I didn't see already posted worth watching/reading. Should give a good intro. Within 3 hours combined (For CPU performance anyway).

A good talk, doesn't go deep and instead goes a bit wide. https://www.youtube.com/watch?v=6RlloT_6WxA

This one explains the black magic the CPU makes have been doing. If you going to be optimizing code you should know your hardware. https://www.lighterra.com/papers/modernmicroprocessors/

Aditional note: I've noticed C++ conventions have a habit of having performance related talks, YT is your friend.

Post reply on HN