Speed up array appends
Mantenedores costumam responder em até 2 dias
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 42/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 861
- Forks
- 201
- Merge médio
- 3d 19h
- PRs com merge (30d)
- 24
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Sem guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de python-poetry/tomlkit
-
`update()` on an out-of-order table raises `IndexError` after a sub-table fragment was poppedTalvez já em andamento @rajmodi8905 assumiu há 4 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
python-poetry/tomlkit#675 · 2 comentários ·
Mantenedores costumam responder em até 2 dias
-
Deleting the last key under a dotted key in an inline table produces invalid TOMLTalvez já em andamento @cig13zs assumiu há 10 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 62/100
python-poetry/tomlkit#662 ·
Mantenedores costumam responder em até 2 dias
-
AttributeError on an out-of-order table under an indented header (4+ levels)Talvez já em andamento @cig13zs assumiu há 10 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 18/100
python-poetry/tomlkit#661 ·
Mantenedores costumam responder em até 2 dias
-
Regression: impossible to dump multiline strings with leading newlineTalvez já em andamento @shivampwm2020 assumiu há 12 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 25/100
python-poetry/tomlkit#655 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
In-place array repetition changes values without updating serialized TOMLTalvez já em andamento @harbinresearcher assumiu há 14 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
python-poetry/tomlkit#646 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
Todas as issues de python-poetry/tomlkit
Issues semelhantes
-
link-rot
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 67/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
developmentseed/titiler-cmr#265 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Insecure Brotli version <1.2.1Talvez já em andamento @jamescw19 assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
stac-utils/stac-fastapi-pgstac#438 · 1 reação ·
-
bug triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 1 dia