Hi Ilia,
Oh, sorry, didn't know it was a time issue. :-) I thought both branches
were mostly always updated together to keep things synced, etc. In that
case, if it saves you any time, I've attached the patch for HEAD.
----- Original Message -----
From: "Ilia Alshanetsky"
Sent: Monday, November 13, 2006
Matt,
I did a cursory check through ext/ and this seems like the only place
the optimization trick can be applied. I will look into writing a
patch for HEAD when I have a bit more time.
On 12-Nov-06, at 6:20 PM, Matt Wilmas wrote:
> Hi Ilia,
>
> Ah, I had wondered what other places could be changed to use the
> _quick
> functions (but didn't really check). :-) Anyway, will this be
> applied to
> HEAD also?
>
>
> Matt
>
>
> ----- Original Message -----
> From: "Ilia Alshanetsky"
> Sent: Sunday, November 12, 2006
>
>> iliaa Sun Nov 12 17:13:23 2006 UTC
>>
>> Modified files: (Branch: PHP_5_2)
>> /php-src NEWS
>> /php-src/ext/standard array.c
>> Log:
>> Optimized array functions utilizing php_splice().
>>
Index: ext/standard/array.c
===================================================================
RCS file: /repository/php-src/ext/standard/array.c,v
retrieving revision 1.390
diff -u -r1.390 array.c
--- ext/standard/array.c 12 Nov 2006 01:11:58 -0000 1.390
+++ ext/standard/array.c 13 Nov 2006 15:04:19 -0000
@@ -1977,7 +1977,7 @@
if (p->nKeyLength == 0) {
zend_hash_next_index_insert(out_hash, &entry,
sizeof(zval *), NULL);
} else {
- zend_u_hash_update(out_hash, p->key.type,
ZSTR(p->key.arKey.s), p->nKeyLength, &entry, sizeof(zval *), NULL);
+ zend_u_hash_quick_update(out_hash, p->key.type,
ZSTR(p->key.arKey.s), p->nKeyLength, p->h, &entry, sizeof(zval *), NULL);
}
}
@@ -1989,7 +1989,7 @@
if (p->nKeyLength == 0) {
zend_hash_next_index_insert(*removed, &entry,
sizeof(zval *), NULL);
} else {
- zend_u_hash_update(*removed, p->key.type,
ZSTR(p->key.arKey.s), p->nKeyLength, &entry, sizeof(zval *), NULL);
+ zend_u_hash_quick_update(*removed, p->key.type,
ZSTR(p->key.arKey.s), p->nKeyLength, p->h, &entry, sizeof(zval *), NULL);
}
}
} else /* otherwise just skip those entries */
@@ -2000,17 +2000,7 @@
/* ..for each one, create a new zval, copy entry into it and
copy it into the output hash */
for (i=0; i<list_count; i++) {
entry = *list[i];
- if (entry->refcount>=1000) {
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- *tmp = *entry;
- zval_copy_ctor(tmp);
- tmp->refcount = 1;
- tmp->is_ref = 0;
- entry = tmp;
- } else {
- entry->refcount++;
- }
+ entry->refcount++;
zend_hash_next_index_insert(out_hash, &entry,
sizeof(zval *), NULL);
}
}
@@ -2022,7 +2012,7 @@
if (p->nKeyLength == 0) {
zend_hash_next_index_insert(out_hash, &entry,
sizeof(zval *), NULL);
} else {
- zend_u_hash_update(out_hash, p->key.type,
ZSTR(p->key.arKey.s), p->nKeyLength, &entry, sizeof(zval *), NULL);
+ zend_u_hash_quick_update(out_hash, p->key.type,
ZSTR(p->key.arKey.s), p->nKeyLength, p->h, &entry, sizeof(zval *), NULL);
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php