small optimization by inlining comparison functions when possible