Improve memory performance when generating config static and class caches