After all algorithms and data structures are optimal, we can sometimes further improve program behavior by carefully adding prefetch instructions.
Many times it is difficult to determine the correct place to insert the prefetch instruction and what address to prefetch. Sometimes it helps to augment the data structure that is being traversed with a field containing a hint of the proper address to prefetch, for instance the address of a node several steps away along the linked list.
Tip | |
---|---|
Look for remaining hot-spots and look for good places to insert prefetch instructions. Evaluate the effectiveness of added prefetch instructions. |
Tip | |
---|---|
Consider augmenting "tricky" data structures with a prefetch hint field. |