Optimized file comparison