It gets harder to estimate the further from the "metal" you are, because you may not know how things are laid out in memory, but if you know those things too, you can still use the information.
Not only does it become harder to estimate the further you are from the metal, but in much commercial application development it becomes outright dangerous to do so... In many scenarios you do not want your developer making assumptions about the metal they're sat on.
If you have a number of complicated operations to do on many small objects, it's probably much faster to do all the operations on each object before moving on, rather than doing "passes" for each operation -- unless those operations are going to need to access stuff that isn't going to fit in the CPU cache.
Unless you're running in a managed environment and want to ensure your garbage collection can catch up. And as for the CPU cache, that is not something most programmers should be making assumptions about.
Now the other bullet points that you're beginning to boil down are valid, and downright useful to consider across a very wide range of platforms and areas of development... and do not require an intimate knowledge of memory, while also being digestible by a far wider scope of developers.
You right now if you carry on writing and expand upon your points are more useful to 80% of programmers that will ever read this sub than the cited article.
In many scenarios you do not want your developer making assumptions about the metal they're sat on.
And if you understand the concepts involved, you know what things will carry across from one piece of metal to another...
Unless you're running in a managed environment and want to ensure your garbage collection can catch up.
Unless you're using a lot of compound value types, that's not going to be a concern. And if you are... wtf is wrong with you? That's terrible in any number of ways.
The GC will do its thing when it needs to. Why would doing multiple passes improve GC performance? If anything you'd be generating additional objects (edit: from multiple enumerations), putting greater pressure on the GC...
and do not require an intimate knowledge of memory, while also being digestible by a far wider scope of developers.
I don't have an "intimate" knowledge of memory. I couldn't tell you 95%+ of the details from that article. But reading it allowed me to correct a number of things I had wrong in my mental model of how computer memory works (I don't have any examples; I last read that thing ~5 years ago...)
For me at least, understanding why those things are true, seeing examples of how the branch predictor/memory prefetcher in a modern CPU performs, getting some clue of the architecture of all these things--that means I'll actually retain the information, because it's a complete picture, rather than...
"Do this, and that, and also this."
Admittedly, this article has so much detail that I think you could trim it down substantially while still retaining enough detail to explain why each of those bullet points are usually true.
The programmer should most definitely assume that cache >> main memory >> disk I/O >> network I/O.
And that while many of these protocols have very high throughput in principle, random access patterns tend to aggravate latency issues.
I.e. you can stream from a network share just fine (and the resulting application may in fact be CPU-bound), but doing random access on it is an absolute performance killer.
I largely agree with you, but I wouldn't go so far as to say that disk I/O >> network I/O. There are many cases where a Gigabit ethernet (~100MB/s) will out-strip your local spinning storage. Now, move on to a high-end network, and disk I/O will never keep up versus a copy over the network out of another node's RAM.
2
u/Carnagh Oct 04 '13
Not only does it become harder to estimate the further you are from the metal, but in much commercial application development it becomes outright dangerous to do so... In many scenarios you do not want your developer making assumptions about the metal they're sat on.
Unless you're running in a managed environment and want to ensure your garbage collection can catch up. And as for the CPU cache, that is not something most programmers should be making assumptions about.
Now the other bullet points that you're beginning to boil down are valid, and downright useful to consider across a very wide range of platforms and areas of development... and do not require an intimate knowledge of memory, while also being digestible by a far wider scope of developers.
You right now if you carry on writing and expand upon your points are more useful to 80% of programmers that will ever read this sub than the cited article.