php / php/php-src

Typed property assign should be optimized more

Aperta
#13,100 10 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Feature Status: Needs Triage
Lingua principale
C
Stelle
40.4k
Fork
8.2k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con la riproduzione 3v4l.org/FGeEf e profila il caso di assegnazione di una proprietà tipizzata rispetto all’interprete PHP attuale. Determina quale percorso di allocazione o assegnazione prevale prima di proporre un’ottimizzazione; il lavoro è completato quando si ottiene un miglioramento misurato senza modificare la semantica, supportato da una verifica mirata di regressione o delle prestazioni, se il progetto ne fornisce una.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c, php
Ambito
backend, performance
Tipo di issue
Refactoring
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.