Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Render loop redraws on every animation frame, even when nothing changed or the terminal is hidden

Abierto
#208 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

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

Línea de trabajo

Start with Terminal.startRenderLoop() and compare its behavior with the xterm.js render service mentioned in the issue. Check how writes, resizing, scrolling, selection, hover, focus, cursor blinking, and element visibility should trigger rendering. Done means unchanged or hidden terminals do not redraw every frame, and a terminal renders again when it becomes visible.

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

Descripción

Version: ghostty-web 0.4.0 (npm latest)

What happens
Terminal.startRenderLoop() schedules requestAnimationFrame on every frame for as long as the terminal is open, and calls renderer.render() each time. It does this when nothing has changed, and also when the terminal's element is hidden (display: none) or off screen. A page that keeps a terminal mounted in the background, as the Pterodactyl panel 2.0 does so that the console survives tab switches, keeps paying for it on every other page.

Measured in Chromium with 4x CPU throttling on a page that keeps a hidden 170x57 terminal mounted while it receives about 10 lines of output per second: about 1.1 s of long animation frames per 6 s attributed to ghostty-web's frame callback, and roughly 25% fewer frames than the same page without the terminal. Unmounting the terminal removed both.

Suggestion

  • Render only when something changed: a write, a resize, scrolling, selection, hover, focus, or the cursor blink. The blink can run on its own timer at its blink rate, not at 60 Hz.
  • Pause rendering while the terminal's element is not visible, for example with an IntersectionObserver on the element, and render once when it becomes visible again. xterm.js does this in its render service.

Related: #198 (at a fractional devicePixelRatio the same loop also resizes and repaints the whole terminal on every frame).

Lenguaje dominante
TypeScript
Estrellas
3k
Forks
193
Merge medio
1 d 40 min
PR fusionados (30 d)
1

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

  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 coder/ghostty-web

Todos los issues de coder/ghostty-web

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.