php / php/php-src

Typed property assign should be optimized more

Offen
#13,100 10 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Feature Status: Needs Triage
Vorherrschende Sprache
C
Sterne
40.4k
Forks
8.1k
Ø Merge
2 T. 13 Std.
Gemergte PRs (30 T.)
96

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Reproduktion 3v4l.org/FGeEf und profiliere den Fall der Zuweisung einer typisierten Eigenschaft im Vergleich zum aktuellen PHP-Interpreter. Ermittle, welcher Allokations- oder Zuweisungspfad dominiert, bevor du eine Optimierung vorschlägst; als abgeschlossen gilt die Aufgabe mit einer gemessenen Verbesserung ohne Änderung der Semantik, unterstützt durch eine fokussierte Regression oder Performance-Prüfung, falls das Projekt eine solche bereitstellt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, php
Bereich
backend, performance
Issue-Typ
Refactoring
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.