On Mon, May 13, 2013 at 7:49 AM, Dmitry Stogov <dmi...@zend.com> wrote:

> Hi Nikita,
>
> The patch looks quite good.
> However, it must slow down each comparison operator (even if it compares
> two integers).
>
In most cases it shouldn't, as the comparisons usually go through the
fast_is_*_functions, which have special handling for integers and doubles.
is_equal_function itself for example is only used in the implementation of
ZEND_CASE (why? shouldn't we use the fast_ one here too?) and stuff like
array_search.

I would suggest overloading of CMP operator instead of separate <, <=, ==,
> !=, >, >=.
>
But yeah, that sounds like a better solution. The advantages I see:
a) It will automatically work with sorting functions (and other stuff using
compare_function). This is a pretty big plus.
b) You don't have to implement the same (or similar) code for four (or six)
operators.
c) It (at least partially) also solves the concerns raised by Sara.

Would need an additional object handler though (as compare_objects works
only on objects, so it's currently not possible to support something like
$gmp == 0).

Nikita

Reply via email to