Speed up array appends
Les mainteneurs répondent en général sous 2 jours
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 42/100
Piste de recherche
Start from the array append path that tomlkit.dumps reaches when a Python list is converted, and find where the index is rebuilt for every existing item. Time the 3000-item example before changing anything. Done means that a normal append only indexes the new item, middle inserts and special formatting items still rebuild, and the output text and existing tests stay the same.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Adding an item to the end of an array rebuilds the index for every item already in it. So when an array is built one item at a time, the same entries get checked over and over.
This also happens when writing a Python list with tomlkit.dumps, not just when calling append directly. It can add up when writing a long file list or dependency list.
For example, this goes through the repeated append path:
import tomlkit
files = [f"src/package/module_{n}.py" for n in range(3000)]
text = tomlkit.dumps({"files": files})
For a normal append, the old items haven't moved. Could we keep their indexes and add only the new one? Middle inserts and the special formatting items can keep the current rebuild.
For N normal appends, that would bring the index work from O(N²) to O(N), without adding another cache. Converting the values and writing the TOML would still take their own time.
- Langage dominant
- Python
- Étoiles
- 862
- Forks
- 193
- Merge moyen
- 4 j 2 h
- PR mergées (30 j)
- 25
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python-poetry/tomlkit
-
Deleting the last key under a dotted key in an inline table produces invalid TOMLPeut-être pris @cig13zs l’a pris il y a 2 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 62/100
python-poetry/tomlkit#662 ·
Les mainteneurs répondent en général sous 2 jours
-
AttributeError on an out-of-order table under an indented header (4+ levels)Peut-être pris @cig13zs l’a pris il y a 2 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 18/100
python-poetry/tomlkit#661 ·
Les mainteneurs répondent en général sous 2 jours
-
Regression: impossible to dump multiline strings with leading newlinePeut-être pris @shivampwm2020 l’a pris il y a 3 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 25/100
python-poetry/tomlkit#655 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
In-place array repetition changes values without updating serialized TOMLPeut-être pris @harbinresearcher l’a pris il y a 5 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 35/100
python-poetry/tomlkit#646 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
tomlkit 0.15.1 fails on out-of-order table headerPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
python-poetry/tomlkit#632 ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de python-poetry/tomlkit
Issues similaires
-
bug needs-triage priority:medium
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
yeongseon/azure-functions-logging-python#583 ·
Les mainteneurs répondent en général sous 1 jour
-
documentation needs-triage priority:medium
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
yeongseon/azure-functions-validation-python#546 ·
Les mainteneurs répondent en général sous 1 jour
-
PHP workflow streaming requests buffer the full SSE responsePeut-être pris @Winoren l’a pris aujourd’hui. Ouvertereview: medium
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
langgenius/dify#44270 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
P4: low
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
jeffknupp/association#523 ·
-
bug help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
DarkStarSystems/pcons#229 ·
Les mainteneurs répondent en général sous 1 jour