HermitCrab analysis: a per-word root-search cache cut Sena work 21.3% in the port; C# repeat-lookup share unmeasured
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
- 38/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- csharp
- Área
- performance
Línea de trabajo
Read row 28 of the #490 ledger and the issue’s C# versus PanGloss comparison first. Measure the cost of repeated (stratum, shape) root-trie lookups on Sena in C# before implementing anything. Done means reporting whether that work share is material and, based on the result, whether to port the bounded per-word cache.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Claude-drafted.
A per-word root-search cache cut Sena work by 21.3% in the Rust port, but the C# record says repeated root lookups are only 0.5 to 3.3% of parser work. Whether C# has the same gap is unmeasured. Analysis branches that reach the same (stratum, shape) repeat the identical root-trie search.
Status: merged in the port; not built in C#.
What we know (port, work steps; parses identical on every completed word):
- Sena: 182,297,249 to 143,399,740 (-21.3%, measured before the edge index of #599 landed). Mbugwe -0.6%; Cebuano -0.1%, or -1.2% with an added enclitic; the other samples and fixtures about 0.
- It holds the raw ordered trie result per word, keyed by exact (stratum, shape), capped at 1 MiB (peak 1.04 MB on Sena), and is discarded after each word. Lexical-entry filtering, overlay and dedup still run on every lookup. A capped or timed-out search is never cached. A result is stored only if its search cost more than a hit is charged, so no path costs more.
- Ledger row 28 closed a similar C# cache: untraced C# makes 1.13 to 1.49 calls per distinct (stratum, shape).
- Inferred: the port's larger gain comes from charging a lookup per trie edge, which makes repeats dearer than in C#'s unit.
Not known: the share of C# work spent on repeated lookups on Sena.
Proposed change: measure that share first, on hc.dll, in lookups and work steps. Port the cache only if the share is material, and then only after an explicit decision against the no-memoization rule (ledger row 38): it is a bounded memo.
Related:
- PanGloss: sillsdev/PanGloss#92 (closed by PR sillsdev/PanGloss#96, merged).
- sillsdev/machine#599 (open); #490 (closed PR, retired record).
Next: count untraced repeated (stratum, shape) lookups and their work on Sena in hc.dll.
Evidence -- numbers, method
From PanGloss PR #96 and its lane report (single-threaded --stats).
| Grammar | Work before | Work after | Peak cache |
|---|---|---|---|
| Sena | 182,297,249 | 143,399,740 (-21.3%) | 1,042,524 B |
| Sena, with the port's edge index (#599) and cache together | 182,297,249 | 138,405,255 (-24.1%) | 1,042,524 B |
| Mbugwe, 1,636 completed words | 35,582,069,812 | 35,354,992,356 (-0.6%) | 1,048,396 B (cap 1,048,576) |
| Cebuano base | 5,395,400 | 5,392,090 (-0.06%) | 427,336 B |
| Cebuano with enclitic | 6,340,178 | 6,265,316 (-1.2%) | 427,336 B |
Cebuano rows compare against a build with the edge index but no cache. Seven Mbugwe words never complete on either build and are unverified. Cache bounds are conservative allocation estimates, not allocator measurements.
Surprising findings -- why this reopens a closed ledger row
Row 28 closed the cache because trace mode (which disables merging) had inflated the lookup count to 97,575 over 56 shapes. Untraced, repeat-lookup work was 0.5 to 3.3% of parser work (10.4% only on row 25's pre-fix bug); lookup was 1 to 12% of parser work. PanGloss merged a narrower version anyway: per word, exact key, capped, discarded after each word.
Lookup gap (search-cost round, open lead 14): on the slowest word of one private project, the port made 18 lookups on C#'s export against C#'s 49. Parses were identical and the cause was not investigated there. Ledger row 24 later attributed a related gap (18 lookups against 1,655 on the port's own snapshot) to a loading difference, not search. Neither figure is evidence about repeats in C#.
Sources -- pinned
- Lenguaje dominante
- C#
- Estrellas
- 29
- Forks
- 16
- Merge medio
- 5 d 21 h
- PR fusionados (30 d)
- 9
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
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 sillsdev/machine
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 28/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
Todos los issues de sillsdev/machine
Issues similares
-
effort:S P3 refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nightscout/nocturne#3243 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
dasher-project/Dasher-Windows#84 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
libnativeapi/nativeapi#21 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 3 días
-
enhancement P3 performance
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
thomhurst/TUnit#7380 · 2 comentarios ·
Los mantenedores suelen responder en 1 día