Performance optimization covers a lot of topics, it depends on what you are trying to optimize. 1. Latency vs throughput. Oftentimes they are the same, i.e. reduce the time it takes to do something. However, when you passed a certain threshold, techniques that can optimize throughput will hurt latency, so it is important to know what you are looking for. There are also low level details if you have rather extreme lat…
Adding to this great list: batch processing inputs can allow you to get more throughput at expense of latency.
Ask HN: How can I learn about performance optimization?
111–120 of 153 posts
Re: Ask HN: How can I learn about performance optimization?
#112Earlier quoted context omitted.
> 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…
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?
In part, it's a somewhat rewarding topic. Thinking about queries, joining a bit differently, adding another index based on new data patterns can cut hours of runtime without incurring further resource cost.
But on the other hand, it's yet another project someone dumped on the floor and we were forced to adopt it "because of the customer". And the second or third project of PD trying to "do it right" is teetering on failure once again. Cron running shell scripts held together with chicken wire and duct tape is too strong of a stack I guess.
Re: Ask HN: How can I learn about performance optimization?
#113For 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,…
I definitely agree with this one, especially on the level of "don't make network calls in your hot loop".
But it should be noted that less efficient algorithms that access memory in a more efficient way (that is to say, get a higher percentage of cache hits when iterating the data) can beat more efficient algorithms that get more cache misses.
That's all to say, iterating over an array is very vast, and iterating through a map is not. Is the map faster if you only need to access a couple things? Well, depends on the dataset size, as well as the constant factor in your map access, and how much of an improvement your other algorithm is.
You should definitely measure that once you've made the change though.
Re: Ask HN: How can I learn about performance optimization?
#114Performance optimization covers a lot of topics, it depends on what you are trying to optimize. 1. Latency vs throughput. Oftentimes they are the same, i.e. reduce the time it takes to do something. However, when you passed a certain threshold, techniques that can optimize throughput will hurt latency, so it is important to know what you are looking for. There are also low level details if you have rather extreme lat…
Adding to this great list: batch processing inputs can allow you to get more throughput at expense of latency.
Re: Ask HN: How can I learn about performance optimization?
#115Earlier quoted context omitted.
> Latency vs throughput. Oftentimes they are the same Latency and thruput are never the same, they don't even have the same units so they can't be the same. Advice to OP. Learn how to make measurements, and you'll never make mistakes like these.
You can expand on a question without being douchey. OP is right that you can often improve both at the same time, it's just worded poorly.
Later though… once your system is somewhat optimized, you will tend to make latency vs throughput decisions. For most people though, slight changes to latency are the cost to large increases in throughput, but that may just be my experience.
Re: Ask HN: How can I learn about performance optimization?
#116Former 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?
#117Former 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…
Re: Ask HN: How can I learn about performance optimization?
#118work 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?
#119Re: Ask HN: How can I learn about performance optimization?
#120It’s really not specific to Julia, though the language does let you drill down into the details nicely.