plugin design efficiency and caching

i often wonder what is the most efficient way to code plugins that add features to commonly loaded pages in elgg. e.g. if i add a dropdown menu to the topbar that is populated with dynamically calculated links via php - where is the best place to put the code that does the calculation?

if i place it in start.php for my plugin then that code is (i think) run on every page load.. yet what if the code in the plugin can be cached along with other plugin setting type variables? is the answer to code the plugin to use variables that are stored via admin panel settings? so that the processing is shifted to back-end admin area and the result is cached?

or does another method exist for situations where an admin panel process/setting is for some reason inappropriate?

thanks