small patch for implode() function

php.internals

Alexander Valyalkin

22 years ago
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/