> A technique I use is to, in the parent process, create and store the > template object, and then loop over all my existing templates and compile > them so they are cached into the object (temporarily turning off / catching > warnings, because they generate a lot in our case, when the proper input > variables are not passed in). So then all the templates have been compiled > in the parent process, and when it forks, the template object and all > templates are ready to go.
I tried that as well, but when I measured the memory used it didn't seem to be a gain. The overrall size was bigger, and there wasn't significantly more memory shared than before. I'm not sure why, but I figured it probably meant that things were being shuffled around in memory causing writes to the copy-on-write pages. - Perrin
