I have similar problem with version 3.1.30
First uncached request is about 10 seconds long. I have traced code and found that it locks cache key (I can see LOCK#... key in APC cache for 10 seconds) and then it generates cache template.

I'm seeing the exact same issue as tpanula. I tried to step backwards and debug it but didn't really know what was going on, but here's what I found.

Smarty has a UID 2d185aa406260ef92fd868208b44ef71f7f07115 and it tries to use it as a key in an array in the Smarty_Template_Complied object ->file_dependency array. But when I look at that, it's not in there. That doesn't stop it from trying to load the file and the plugin.. which makes $type null and later when the regex match tries to verify the plugin authenticity, it fails.