small patch for implode() function

From: Date: Fri, 02 Jul 2004 16:30:47 +0000
Subject: small patch for implode() function
Groups: php.internals 
Request: Send a blank email to internals+get-10875@lists.php.net to get a copy of this message
there is such code in the php_implode() function: [snip]
    while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr),
                                         (void **) &tmp,
                                         &pos) == SUCCESS) {
        SEPARATE_ZVAL(tmp);
        convert_to_string(*tmp);
[snip] SEPARATE_ZVAL() always duplicates data of the tmp, even Z_TYPE_PP(tmp) == IS_STRING. It is terrible slowdowns the implode() function. So, changing the strings
    SEPARATE_ZVAL(tmp);
    convert_to_string(*tmp);
to
    convert_to_string_ex(tmp);
will increase speed twice, because most of elements in the imploding array has IS_STRING type. -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

« previous php.internals (#10875) next »