mirror of
https://github.com/php/frankenphp.git
synced 2026-03-24 00:52:11 +01:00
perf: avoid redundant work in frankenphp_release_temporary_streams()
Persistent streams are of type le_pstream, not le_stream. Therefore, the persistent check will always be false. We can thus replace that check with an assertion. `zend_list_delete` removes the entry from the regular_list table, and calls `zend_resource_dtor` via the table destructor. When the refcount is 1, `zend_list_close` calls `zend_resource_dtor`, but keeps the entry in the table. Multiple calls to `zend_resource_dtor` have no effect: the destructor is only called once. Therefore, the `zend_list_close` operation is redundant because it is fully included in the work done by `zend_list_delete`.
This commit is contained in:
committed by
Kévin Dunglas
parent
d407dbd498
commit
f109f0403b
@@ -121,9 +121,9 @@ static void frankenphp_release_temporary_streams() {
|
||||
if (val->type == stream_type) {
|
||||
php_stream *stream = (php_stream *)val->ptr;
|
||||
if (stream != NULL && stream->ops == &php_stream_temp_ops &&
|
||||
!stream->is_persistent && stream->__exposed == 0 &&
|
||||
stream->__exposed == 0 &&
|
||||
GC_REFCOUNT(val) == 1) {
|
||||
zend_list_close(val);
|
||||
ZEND_ASSERT(!stream->is_persistent);
|
||||
zend_list_delete(val);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user