Today, Cognifide published their new site named Cognifide Labs which contains libraries and tools which can be deployed on Adobe Experience Manager and on Apache Sling based applications. Try to do not reinvent a wheel, maybe some of them could be useful for you?
Personally, I recommend you to firstly see Sling Dynamic Include , which can easy resolve your problems with performance on dynamically rendered pages on publish instances on AEM.
Another interesting tool, which is not yet added to labs is AEM Dash. Do you know ‘Find everywhere’ feature in IntelliJ / PhpStorm? It works similar. Specify bundle name, service configuration, page name or even JCR node name and Dash will find it.