cvs: ZendEngine2 / zend_operators.c
| From: | Sterling Hughes | Date: | Sun, 29 Jun 2003 01:49:10 +0000 |
| Subject: | cvs: ZendEngine2 / zend_operators.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1399@lists.php.net to get a copy of this message | ||
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;
}