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
The repro shows common usecase of modifying currently iterated item/index. CoW is not needed, as the currently iterated item/index will never be iterated again.
In general, any already iterated item/key does not need CoW when unset/modified.
Also $arr append does not need CoW neither as the last element of the original $arr can be easily tracked.
The text was updated successfully, but these errors were encountered:
So, the actual feature request is:
Reorder the FE_FREE (foreach iterated value free) to before exit branches of the foreach (as detectable by the CFG).
Description
Currently, foreach does CoW on any foreach argument (
$arr
) modification. This is too conservative.https://3v4l.org/ShQmT/rfc#vgit.master
The repro shows common usecase of modifying currently iterated item/index. CoW is not needed, as the currently iterated item/index will never be iterated again.
In general, any already iterated item/key does not need CoW when unset/modified.
Also
$arr
append does not need CoW neither as the last element of the original$arr
can be easily tracked.The text was updated successfully, but these errors were encountered: