Problems, Indirection and Performance

Quote 1 : “There is no problem in computer science that cannot be solved by an extra level of indirection.”

Quote 2 : “Any performance problem can be solved by removing a level of indirection”

Software engineers do not need quotes to apply concepts. Many of us would have been following them already.
Was familiar with the first quote for a long time now, came upon the second quote yesterday.

For those who are not very sure what indirection means,

In computer programming, indirection is the ability to reference something using a name, reference, or container instead of the value itself.

Thinking about it, it seems both quotes are right.

Q1. Is performance problem not a computer science problem ?
Q2. If yes, should not a level of indirection solve it too ?
Q3. If yes (tell me how), will this solution in-turn end up being a performance problem ?
Goto Q2.

Q4. When will this looping between Q2 and Q3 end ?

I do have my answers. I will post them later.

Care to give it a thought ?!

(Originally posted on Tue Dec 13, 2005 8:10 pm, in my personal blogs in Currently those blogs have been moved to archive and many links do not work already. So, making a copy here. )


Posted: Thu Dec 15, 2005 1:09 am

Seems some were not able to interpret the meaning of indirection, though (as I had said earlier) most of us would have used it for sure.

I will try to speak in terms of how we use it often…

Executing a piece of code which conforms to some interface, before or after a point in execution, is indirection.
This piece of indirection code can change the values in execution context and also redirect the execution path.

An interceptor in JBoss / NMS-NG or a filter in WebNMS 4 is an example of indirection.

Now for some scenarios of performance problems as mentioned by friends during a chat…

a. Packets from network processed and inserted into database.
b. High volume of data received (from server) in the client, painted onto the client application screen.
c. Server thread processing requests from multiple client’s.
d. Querying database containing a lot of data.

Now let me know how you would normally solve each of these problems ?!

posted by rraj


One Response to Problems, Indirection and Performance

  1. Steve Posick says:

    I would just like to note that your postulation regarding performance being a computer science problem. Being familiar with all aspects of computing and working with both machine language and assembly on multiple platforms, Yes, performance is very much a CS problem. As for indirection, each layer of indirection adds additional cycles of overhead, each cycle is of course time. The further you get from the hardware, the worse the performance of the software.

    Simple examples that prove this statement are C, Pascal, Java, .Net, Hardware Abstraction Layers, and most importantly caching. The largest fundamental myth is that performance can be improved by caching. Caching is a form of buffering and buffering adds overhead if it is not carefully managed. Some buffering is required, but too much will cause numerous issues. A perfect example of buffering causing an issue is network latency. Latency is caused by buffering, the only way to address Latency , without increasing speed, is to reduce the amount of buffering. The caching hypothesis expressed is actually the largest cause of network microbursts, which cause many issue within 1+GE network, costing the financial industry billions of dollars before their discovery.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: