Compact diff calculation