fast realised compare function