danielgtaylor / danielgtaylor/python-betterproto

Rendering comments can be time consuming.

Offen
#682 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
1.8k
Forks
234
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

```
$ time protoc -I . --python_betterproto_out=. douyin2.proto |& head
Writing __init__.py
Writing douyin\__init__.py

real 6m18.150s
user 0m0.015s
sys 0m0.091s
```
After patching `betterproto/plugin/models.py@ProtoContentBase.comment` to return empty string, it's much faster
```
$ time protoc -I . --python_betterproto_out=. douyin2.proto |& head
Writing __init__.py
Writing douyin\__init__.py

real 0m23.077s
user 0m0.000s
sys 0m0.092s
```

Profile flamegraph from `py-spy record`

Image

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start in betterproto/plugin/models.py at ProtoContentBase.comment and use the reported py-spy profile to identify why comment rendering dominates protoc generation. Compare generation against the provided timing example, then verify that comments remain correct while the reported slowdown is substantially reduced.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
devtools, performance
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

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