Optimize xml_path() and xml_find_all() for large node sets
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- r
- Ambito
- performance
Direzione di ricerca
Start with the xml_path() and xml_find_all.xml_node() entry points, then review the regression tests described in the issue. Confirm that batch xml_path() output matches per-node output and that single-context XPath node sets remain unique. Benchmark large node sets and attribute result sets to verify the optimization preserves semantics and improves materialization time.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
xml_path() and xml_find_all() can spend substantial time in wrapper-side work when operating on large node sets.
I have a local branch with two general optimizations, both intended to preserve existing semantics:
- Speed up
xml_path()for largexml_nodesets by caching reusable ancestor paths within a single call. - Speed up
xml_find_all.xml_node()materialization by avoiding an unnecessary duplicate pass for single-context XPath node sets and reducing per-node R object construction overhead.
Is this a direction you would be open to reviewing as a PR?
Isolated benchmark results from my local machine:
-
xml_path()on a synthetic node set with 124,001 nodes:- before: ~0.77s
- after: ~0.07s
-
xml_path()on a large real-world XML bundle with 415,022 selected nodes:- before: ~2.43s
- after: ~0.28s
-
xml_find_all()/ XPath result materialization on large attribute result sets:- synthetic 300k attributes: roughly 1.5-2x faster in the materialization-heavy path
- real-world XML bundle,
//@*, 155,009 attributes: roughly 1.6-2x faster in isolated runs
The changes are not specific to any particular XML schema or downstream package. They target repeated ancestor path construction and large XPath result materialization.
I added regression tests comparing batch xml_path() output to per-node xml_path() output, and checking that single-context xml_find_all() XPath node sets remain unique.
- Lingua principale
- R
- Stelle
- 227
- Fork
- 86
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di r-lib/xml2
-
Export libxml2_version()Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 67/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Issue simili
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
Bioconductor/BiocParallel#289 ·
-
automation
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
waldronlab/BugSigDBcuration#2224 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
merliseclyde/BAS#118 ·