HermitCrab feature structures: reuse traversal state in ValueEquals and Freeze (pooled per-thread sets, no isolated measurement)

Abierto
#589 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp
Área
performance

Línea de trabajo

Start with the linked optimization record and archived branch perf/hc-optimization-archive; review FeatureStruct.ValueEquals, Freeze, and FeatureStructPooledVisitedSetsTests. Measure allocations avoided in isolation, verify the pool stays bounded per thread, and keep the tests for reuse, clearing after success and failure, and reentrancy. Done means the measurements and tests support the change without claiming an unmeasured speedup.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Hermit Crab performance

FeatureStruct.ValueEquals and Freeze allocate visited sets and dictionaries on every call. The change allocates them only once a recursive value is reached. Top-level calls borrow pre-sized collections from a [ThreadStatic] pool and clear them in finally. An InUse guard makes reentrant calls use fresh collections. This is a pool of scratch collections, not a cache of results, and it holds only a few collections per thread. The change is on the archived branch perf/hc-optimization-archive.

Measured. The heaviest Sena profile put feature-structure equality and freezing at 13.7% of wall time, with HashSet resizing a major allocation source. After the change, ValueEqualsImpl and those resizes left the top of the profile. It was not timed in isolation, so no speedup is claimed.

What a revival must do first. Measure it alone, in allocations avoided. Check that the pool size stays bounded per thread. Keep FeatureStructPooledVisitedSetsTests (reuse, clearing after success and failure, reentrancy).

Record: see the archived write-up below
Ledger: https://github.com/sillsdev/machine/pull/490#issuecomment-6701971116; disposition: https://github.com/sillsdev/machine/pull/490#issuecomment-6701971324
From #490 (closed).

Lenguaje dominante
C#
Estrellas
29
Forks
16
Merge medio
4 d 11 h
PR fusionados (30 d)
14

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de sillsdev/machine

Todos los issues de sillsdev/machine

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.