You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Broadly speaking, there's not much point to over optimizing PHP as it's a just-in-time compiler that uses resources briefly to generate pages, except when it comes to the turn scripts. These scripts are run on the command line which means they're not subject to execution or memory limits as much as those ran through the web browser.
PHP itself will start to struggle when it's handling too many objects in memory, which is why a lot of the bulk processing is done through iterators. $doctrine->clear() is good for releasing a lot of stuff, but there's still a lot of left over variables that are never used again that we could clear up as well.
Broadly speaking, there's not much point to over optimizing PHP as it's a just-in-time compiler that uses resources briefly to generate pages, except when it comes to the turn scripts. These scripts are run on the command line which means they're not subject to execution or memory limits as much as those ran through the web browser.
PHP itself will start to struggle when it's handling too many objects in memory, which is why a lot of the bulk processing is done through iterators. $doctrine->clear() is good for releasing a lot of stuff, but there's still a lot of left over variables that are never used again that we could clear up as well.
https://stackoverflow.com/questions/584960/whats-better-at-freeing-memory-with-php-unset-or-var-null has a good discussion on this but it boils down to:
$var = null;
unset($var);
This reduces the memory allocation then flags it cleanup. Don't use this inside loops though, as you're adding a bunch of extra memory work.
The text was updated successfully, but these errors were encountered: