Use zval storage for php://memory stream
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 領域
- backend, performance
調査の方向性
まず php://memory ストリームの実装を追跡し、そのストレージ動作を issue で説明されている zval ベースのカスタムラッパーと比較します。php://temp をどのように扱うべきか、また約 200K のサイズ上のトレードオフが設計にどのような影響を与えるかを判断します。ストリームが copy-on-write の恩恵を受けつつ、より小さい文字列のパフォーマンスを低下させないことが完了の条件です。
索引モデルが issue の本文から書いたものです。
説明
Description
The following code increases the peak memory usage of PHP twice:
$content = str_repeat('hello', 50000);
$h = fopen('php://memory', 'r+');
fwrite($h, $content);
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.
https://github.com/Nyholm/psr7/pull/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 https://github.com/Nyholm/psr7/pull/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?
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 103
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
php/php-src のほかの issue
-
Bug SAPI: cli_server Status: Verified
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
Bug Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
Bug Status: Needs Triage
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
Bug Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
Bug Category: Tests Status: Verified
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
zephyrproject-rtos/zephyr#119726 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
api7/lua-resty-saml#63 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
BasedHardware/omi#15320 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
FujiNetWIFI/fujinet-firmware#1649 · コメント 2 件 ·