Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_operators.c

From: Date: Sun, 29 Jun 2003 08:15:24 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_operators.c
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-1402@lists.php.net to get a copy of this message
I think we should use the first rule of optimizations here... If it breaks compatibility, we're better off without it. Zeev At 08:00 29/06/2003, Andi Gutmans wrote:
Nice idea but it breaks comparisons of doubles with ints, and in general the result has now changed when comparing numbers. If you want some test cases check the results of: "1.0" "1" "2.0" "5.00" Now in general, we could add something like this to zend_binary_strcmp() but it would also change the results. The question is if we can live with these changes as behavior of PHP might slightly change. Andi At 01:49 AM 29/6/2003 +0000, Sterling Hughes wrote:
sterling                Sat Jun 28 21:49:10 2003 EDT
Modified files:
    /ZendEngine2        zend_operators.c
Log: Very simple, but very effective optimization. Provides a signifigant speed improvement to matches done via '=='. This checks that the lengths of two strings are equal before performing a memcmp() on them. Index: ZendEngine2/zend_operators.c diff -u ZendEngine2/zend_operators.c:1.156 ZendEngine2/zend_operators.c:1.157 --- ZendEngine2/zend_operators.c:1.156 Tue Jun 10 16:03:25 2003
+++ ZendEngine2/zend_operators.c        Sat Jun 28 21:49:10 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: zend_operators.c,v 1.156 2003/06/10 20:03:25 imajes Exp $ */ +/* $Id: zend_operators.c,v 1.157 2003/06/29 01:49:10 sterling Exp $ */ #include <ctype.h> @@ -1200,7 +1200,11 @@
        }
        if (op1->type == IS_STRING && op2->type == IS_STRING) {
-               zendi_smart_strcmp(result, op1, op2);
+               if (op1->value.str.len == op2->value.str.len) {
+                       zendi_smart_strcmp(result, op1, op2);
+               } else {
+                       ZVAL_LONG(result, 1);
+               }
                return SUCCESS;
        }
-- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.zend-engine.cvs (#1402) next »