Rearrange the Execution Order for Efficiency
Rearranging execution order for efficiency means executing such job that requires less execution time. By rearranging the object in ascending order of their execution time, we can raise the efficiency of the system.
After adjusting structure of the object model to optimize frequent traversals, next thing to optimize is an algorithm itself. Actually, "algorithms and data structure are directly related to each other", but we find that usually data structure should be considered first.
The way to optimize algorithm is "to remove dead paths as early as possible".
For illustration, suppose we want to find all employees who speak both Japanese and French, and presume 5 employees speak Japanese and 100 speak French. In such case, it is better to test and find Japanese speakers first, then test if they can speak French. In general, it pays to narrow search as soon as possible. Sometimes execution order of a loop must be inverted from the unusual specification in the functional model to get competent results.