This is why I prefer a self-optimizing collections library. Many of these inefficient passes can be internally re-wired when combining 'objects' which represent the functions and their rules of composition.
Inline 'debug' pipeline functions are helpful for the second problem you mentioned.