Reduce repeated Need-graph lookups when rereading report templates

Aberta
#1,078 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
performance

Direção de pesquisa

Profile _reread_post_template_pages and _LinkedNeeds._resolve_backlinks in src/extensions/score_sphinx_needs_templates/__init__.py. Read how _get_available_needs() combines the live graph with the saved Needs and how backlink resolution includes outgoing links; compare that behavior with the existing report output fixtures, including mounted cross-document reports. Done means the reread pass is faster while preserving live updates, backlink order, version-qualified IDs and duplicate handling.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

performance

What

Rereading seven report pages after Sphinx merges the parallel reader environments took about 14 seconds in Reference Integration. The report templates do this second pass so their tables can see Needs and links from other documents.

Technical approach

Profile _reread_post_template_pages and _LinkedNeeds._resolve_backlinks in src/extensions/score_sphinx_needs_templates/__init__.py. The current helper can scan all Needs for each backlink lookup and copy the graph to overlay temporarily removed Needs. Test a reverse-link index for the reread pass and an overlay that avoids copying the full mapping. Preserve live updates during document replacement, backlink order, version-qualified IDs and duplicate handling.

Measurement and reproduction dump

The env-updated hook _reread_post_template_pages took 13.905 s with 36,806 Needs in a local build of Reference Integration #501 using docs-as-code v9.0.0. The seven pages use templates marked score: render-after-needs-collection. The marked templates are module_verification_report, platform_verification_report and tool_qualification_report.

_get_available_needs() combines the current graph with the snapshot of Needs cleared for rereading. _resolve_backlinks() merges pre-existing backlinks with outgoing links from the live collection because some links have been injected and the upstream backlink index can still be incomplete. Any index needs to reflect that same view, including changes from earlier pages in the reread.

In the same phase trace, test import took 16.146 s, source/test link injection 5.680 s and bundle metadata 0.070 s. The 13.905 s number measures the whole reread callback. The proposed lookup changes have not been benchmarked. Compare with instrumented handler timings and existing report output fixtures, including mounted cross-document reports.

Related performance measurements and CI context are in https://github.com/eclipse-score/docs-as-code/issues/1075.

Linguagem predominante
Python
Estrelas
11
Forks
39
Merge médio
1d 13h
PRs com merge (30d)
65

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

  • Sem Dockerfile nem arquivo Docker Compose
  • Tem um modelo de pull request
  • Sem guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de eclipse-score/docs-as-code

Todas as issues de eclipse-score/docs-as-code

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.