Skip to content

Conversation

iluuu1994
Copy link
Member

@iluuu1994 iluuu1994 commented Sep 18, 2025

Simple synthetic benchmark:

function foo() {}

$array = [];
for ($i = 0; $i < 10_000_000; $i++) {
    $array[] = foo(...);
}

foreach ($array as $foo) {}

echo json_encode(gc_status(), JSON_PRETTY_PRINT);
❯ php-old -d memory_limit=-1 test.php
{
    "running": false,
    "protected": false,
    "full": false,
    "runs": 44,
    "collected": 0,
    "threshold": 450001,
    "buffer_size": 524288,
    "roots": 100043,
    "application_time": 1.841229413,
    "collector_time": 0.203653695,
    "destructor_time": 0,
    "free_time": 0
}

❯ php-new -d memory_limit=-1 test.php
{
    "running": false,
    "protected": false,
    "full": false,
    "runs": 0,
    "collected": 0,
    "threshold": 10001,
    "buffer_size": 16384,
    "roots": 0,
    "application_time": 1.635467089,
    "collector_time": 0,
    "destructor_time": 0,
    "free_time": 0
}

There should be virtually no downside to this, so hopefully this is still good for 8.5?

@bwoebi
Copy link
Member

bwoebi commented Sep 18, 2025

This looks sensible to me.

@iluuu1994 iluuu1994 force-pushed the non-collectable-enums-and-fake-closures branch from 77eb754 to 9d5327f Compare September 21, 2025 20:59
@iluuu1994 iluuu1994 marked this pull request as ready for review September 21, 2025 21:04
@iluuu1994 iluuu1994 requested a review from dstogov as a code owner September 21, 2025 21:04
@iluuu1994 iluuu1994 requested a review from a team September 21, 2025 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants