mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
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.
This commit is contained in:
parent
505fd434ac
commit
f605f0b708
@ -1200,7 +1200,11 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user