Can someone give me examples of overhead and bottleneck?

Started by
1 comment, last by King Mir 10 years, 3 months ago

To me, bottleneck seems to be a limitation of a system or environment that disallows a normal process from happening.

To me, overhead is a cost associated with the function or method of the program that has a lot of time complexity not sure if it uses space complexity too.

Not sure if my statements are correct. Examples from you all would clear a lot of things up.

But I managed to read the definitions from Wikipedia to get some ideas. But it still feels vague or uncertain to me because I am not sure how credible the below sources are.

http://en.wikipedia.org/wiki/Bottleneck

http://en.wikipedia.org/wiki/Overhead_(computing)

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

Examples:
- 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'.
OR
- 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.

Examples:
- (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).
A bottleneck is the part of your code or machine which most limits the performance of your code. You want to identify bottleneck in a program so that you focus optimizing them for performance, and don't waste time optimizing code that's not critical. Sometimes you can't do anything about the bottleneck, sometimes you can.

Commonly, a particular system resource is a bottle neck, such as network speed for communication application, RAM latency for Databases (or Drive speed for really big databases), the Drive for File mutating applications, or a particular CPU cache's speed for moderate size data crunching.

You can also think of a particular operation of a program as being a bottleneck if a lot more time is spend doing it than other operations, particularly if that part does not compete heavily with other part of the code. For instance, a chess program probably has AI as a bottleneck and graphics and sound are not performance critical.

---

Nypyren defined overhead pretty well. Anytime the program needs to do more than you want, that's overhead. Overhead can be unavoidable sometimes. Other times it might be insignificant and not worth bothering trying to remove it. Overhead is most often thought of in terms of time, because you optimize for performance, but memory overhead can be relevant too.

This topic is closed to new replies.

Advertisement