Serializer: `write_escaped` is O(n²) when text doesn't contain `<`, `>` or `"`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- rust
- Área
- performance
Línea de trabajo
Start in html5ever/src/serialize/mod.rs at HtmlSerializer::write_escaped, then build and run the html2html example with the reproduction in the issue. Compare timings as the input grows for & and versus &<; done means the problematic inputs no longer show the reported quadratic scaling.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
HtmlSerializer::write_escaped finds the next byte to escape with two memchr searches (introduced by #740):
If the text doesn't have an <, > or ", every & or non-breaking space will cause a full scan of the remaining text.
It's pretty common for text to contain & and without <s or >s.
Repro using the html2html example:
cargo build --release -p markup5ever_rcdom --example html2html
TIMEFORMAT='%R s'
for text in '&' '&<' ' '; do
for count in 100000 200000 400000; do
yes "$text" | head -n "$count" | tr -d '\n' > input.html
echo -n "$text x $count: "
time target/release/examples/html2html < input.html > /dev/null
done
done
On a Linode G6 Dedicated machine with 2 vCPUs and 4 GB RAM, I get:
& x 100000: 0.148 s
& x 200000: 0.462 s
& x 400000: 1.665 s
&< x 100000: 0.096 s
&< x 200000: 0.197 s
&< x 400000: 0.376 s
x 100000: 0.241 s
x 200000: 0.839 s
x 400000: 3.492 s
- Lenguaje dominante
- Rust
- Estrellas
- 2.6k
- Forks
- 299
- Merge medio
- 8 d 22 h
- PR fusionados (30 d)
- 3
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de servo/html5ever
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
rcdom: selectedcontent lookup reads self.data, option clone never runsPosiblemente ocupada @jdm la tomó hace 74 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
servo/html5ever#776 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Tree builder: leftover active-formatting markers make each formatting end tag O(list length)Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 Medio día Aptitud para principiantes 66/100
servo/html5ever#797 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Tokenizer: duplicate-attribute check is O(n²) in a tag's attribute countPosiblemente ocupada @tstreule la tomó hace 5 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
Todos los issues de servo/html5ever
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
DioxusLabs/blitz#1371 ·
Los mantenedores suelen responder en 1 día
-
follow-up
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
carrick-sh/carrick#1494 ·
Los mantenedores suelen responder en 1 día
-
test(hydro_std): track_membership join and leave are untestedPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
hydro-project/hydro#3289 ·
Los mantenedores suelen responder en 1 día
-
diagram-bug good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
enhapu-afk/omaspec#4 ·