Coverage could point out writes that make method calls slower
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #1153 de @alantriesagain — cerrado sin fusionar
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
- Área
- developer-experience, tooling
Línea de trabajo
Read the open pull request #1153 and the related issues #1148 and #963 first; the issue names no source files or tests. The request is for scriptc coverage to report writes that make method calls slower and support --fail-on=slow-paths, but it leaves diagnostic and CLI design choices open. Done would mean the report identifies affected methods, gives a hint, and CI can fail on those sites.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
scriptc coverage tells us whether a program compiles and where it may behave differently from Node. It does not say when a single line makes a large part of the program slower. In our case (#1148) one write made every method call go through a lookup on the object, and coverage still reported "fully static". The follow-up in #963 mentions the same blind spot: "static coverage was 100% on every broken build".
Take this program:
class Counter {
n = 0;
bump(): void {
this.n++;
}
}
function remember(cache: Record<string, unknown>, key: string, value: unknown): void {
cache[key] = value;
}
const counter = new Counter();
remember({}, "last", counter);
for (let i = 0; i < 1000; i++) counter.bump();
console.log(counter.n);
cache[key] = value could replace any method, so every call to bump is looked up on the object. That is correct, but nothing in the coverage report shows it. It would help to see these lines listed, with the methods they affect and a hint on how to avoid it, and to have a way to fail CI on them for projects that care about speed. We use something like this:
scriptc coverage report-demo.ts
statements analyzed 8
compile statically 8 (100%)
fully static — all analyzed statements compile to native code.
slower natively 1 site (compiles and behaves like Node; makes calls slower)
×1 SC7001 this write's key can name any property, so calls to method 'bump' dispatch dynamically: each call reads the method from the instance and boxes the receiver
at report-demo.ts:9:3
hint: type the key as a number or a string literal, write into an object created in this scope, or keep the entries in a Map
with scriptc coverage --fail-on=slow-paths in CI.
We built this for our own use and opened #1153 in case it is useful. It adds a new SC7xxx band of notes and a --fail-on value, which are design choices for you to make, so please treat the PR as a starting point, or close it, as you see fit.
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.7k
- Forks
- 229
- Merge medio
- 14 h 29 min
- PR fusionados (30 d)
- 787
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la 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 vercel-labs/scriptc
-
Dificultad 4/5 3-5 días Aptitud para principiantes 58/100
vercel-labs/scriptc#4865 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 58/100
vercel-labs/scriptc#4864 ·
Los mantenedores suelen responder en 1 día
-
Windows ARM64 as a cross-compile targetPosiblemente ocupada @hum-n la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
vercel-labs/scriptc#4858 ·
Los mantenedores suelen responder en 1 día
-
post-merge-bisect-unresolved
Dificultad 3/5 1-2 días Aptitud para principiantes 43/100
vercel-labs/scriptc#4791 ·
Los mantenedores suelen responder en 1 día
-
post-merge-bisect-unconfirmed
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
vercel-labs/scriptc#4755 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de vercel-labs/scriptc
Issues similares
-
bug data-types
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
ClickHouse/clickhouse-js#1293 ·
Los mantenedores suelen responder en 1 día
-
area: middleware enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
agent/quality testing
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
juspay/agent-distro#203 ·
Los mantenedores suelen responder en 1 día