Improved build time

Here are the changes I talked about in https://github.com/CocoaPods/CocoaPods/issues/1050#issuecomment-18142331. The will speed up the build time quite a lot for projects with many resources.