php / php/php-src

Typed property assign should be optimized more

オープン
#13,100 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Feature Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

Classes are very often used as a simple data holding structure which is created and destroyed millions times per script lifecycle/run.

In https://3v4l.org/CMktE/rfc#vgit.master I have discovered a "class like struct" is slower than an array. This is something not fully surprising on the first sight.

However, https://3v4l.org/hSSFJ/rfc#vgit.master, same demo with propoted properties only, with empty constructor, is not (much if any) faster.

Initially I thought the interpreted code in the constructor will contribute the most to the total run time. This seems to be not true, it seems the most of the time is spent in object allocation and release. If an object has no cycles, it should be fast. I hope there is a room to optimize the object allocation/release more and make this core part of php faster.

let's focus on typed property assign performance solely here

repro: https://3v4l.org/FGeEf

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

3v4l.org/FGeEf の再現から始め、現在の PHP インタープリターに対して型付きプロパティの代入ケースをプロファイリングしてください。最適化を提案する前に、どの割り当てまたは代入経路が支配的かを特定してください。意味論を変更せずに測定可能な改善を達成し、プロジェクトが提供している場合は、焦点を絞ったリグレッションまたはパフォーマンスチェックで裏付けられれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, php
領域
backend, performance
issue の種類
リファクタリング
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。