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 reason is that PHP cannot currently use copy-on-write when writing to the stream.
This is something that can be worked around by using a custom stream wrapper that keeps data in a zval, as done in e.g. Nyholm/psr7#230
Using this proved useful for strings longer than ~200K. For smaller strings, using a custom stream wrapper has a higher cost than the memcopy (see Nyholm/psr7#241).
Could it be possible to improve php://memory (and possibly php://temp) to make it use a zval storage to benefit from copy-on-write?
The text was updated successfully, but these errors were encountered:
Description
The following code increases the peak memory usage of PHP twice:
The reason is that PHP cannot currently use copy-on-write when writing to the stream.
This is something that can be worked around by using a custom stream wrapper that keeps data in a zval, as done in e.g.
Nyholm/psr7#230
Using this proved useful for strings longer than ~200K. For smaller strings, using a custom stream wrapper has a higher cost than the memcopy (see Nyholm/psr7#241).
Could it be possible to improve
php://memory
(and possiblyphp://temp
) to make it use a zval storage to benefit from copy-on-write?The text was updated successfully, but these errors were encountered: