danielgtaylor / danielgtaylor/python-betterproto

Rendering comments can be time consuming.

Open
#682 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.8k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

```
$ 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

Contributor guide

Open the contributing guide

Research direction

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.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.