In a program, a bottleneck is when an identifiable feature (part of your program or something your program relies on) is limiting the speed of the rest of your process somehow. It's used very loosely.
- Any I/O which the rest of the program is waiting on.
- When the CPU is waiting for the GPU or vice-versa.
- When multiple processes/threads fight over a single resource (I/O, mutex, etc).
- When your program cannot keep up with a real-time process (if you cannot decode audio/video fast enough to play it in real time).
Overhead is either:
- When you're being needlessly wasteful, the 'waste' can be called 'overhead'.
- When you're required to do more work or store more data than you want to, the extra that you don't care about is the 'overhead'.
Overhead is purely subjective; A computer that's functioning normally does ONLY what it's programmed to do, so ostensibly there is never overhead from its point of view.
Generally, programmers should think about whether they are making required overhead worse by writing their code in certain ways.
- (required) Stack frame setup/teardown when calling functions.
- (wasteful) Using recursion when you don't need to.
- (required) Network packet headers.
- (wasteful) Sending one byte of payload data per packet instead of waiting a bit to send more data at once.
- (required) Locking a texture to access its pixel data.
- (wasteful) Locking and unlocking once per pixel instead of locking, writing a bunch of pixels, then unlocking.
- (required) Allocating a stack and ThreadContext when creating a thread.
- (wasteful) Creating and destroying threads for many short-lived tasks instead of reusing them (a Thread Pool).
Edited by Nypyren, 19 December 2013 - 09:38 PM.