Bubble Sort Too Slow? Add Concurrency!
Which comes first, the blackboard structures or the formal languages or the partitioning or the high-level paradigms or the AI-incomplete issue or the questions about algorithm performance?
In the spirit of concurrency, we've kind-a been time slicing them all. Each one has had a quantum or two on the CPU. But we've made certain assumptions.
The first assumption is that performance has been improved as much as it practically can be using the sequential model that is currently inplace. But time and again we find that we assumed too fast. While testing one of the modules that we are retrofitting, we're running the basic
time() function on it just to get a sense of wall-clock time as we clean it up. But we find it's taking 2-3 minutes to run. We dig a little deeper and find that the module is building a tree that will later be searched by another module in the system. But the tree building algorithm is mediocre at best. There are much better algorithms available. So before we went any further, we switched algorithms. After the switch we tested the module again. The minutes changed to 10-15 seconds! Of course I had to ask the question "Now why are we trying add concurrency to this module again?"
The processor wars spoiled a lot us in development. I guess we ceased to try to improve algorithms or look for better algorithms in favor of just waiting for the newest processor to speed up our programs and systems. After what I saw this weekend, I can't help but wonder how many retrofitting projects are going on out there just to speed up a poor choice or outdated choice of algorithms and and data structures. Yes, multicore is here, and it's here to stay, but ...
Don't add complexity to the architecture of the system if a better sequential algorithm or improved sequential algorithm will get you the speed up you need.
Formal language will help us deal with the complexity of concurrent designs, but let's not deal with the complexity until we absolutely have to. There are some basic adages in software development. Make sure it's correct before you worry about making it fast. Well to this we add:
Make sure you take advantage of the sequential speed available before you worry about adding concurrency and parallelism.
Sometimes this is just a simple matter of revisiting the search, sort, insert, update, and delete algorithms that a module is using. In other cases we're finding inefficient file handling is at the heart of the problem. All of these things should be dealt with prior to committing to a retrofitting project....