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

Small string optimization (SSO)

Abierto
#907 0 comentarios 2 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
c
Área
performance

Línea de trabajo

Start by reading quickjs.c, especially the JSString fields p->len and p->u.str8 and the JSValue representation described in the issue. Investigate whether small string optimization is worthwhile on 64-bit builds and feasible on 32-bit builds, including the stated access overhead. Done means providing evidence about the memory savings and tradeoffs on both build types.

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

Descripción

enhancement

Something to investigate: is SSO a worthwhile memory saving? My hunch says yes for 64 bits builds, no for 32 bits builds.

32 bits builds use NaN boxing. I don't think there's enough room left to store anything meaningful. On 64 bits systems:

  1. a JSValue is a 64 bits type tag + a 64 bits inline value or pointer

  2. There are only ~15 type tags at the moment; let's carve out space for 32 just in case

That leaves 64 + 64 - 5 = 123 bits or 15 bytes for storing strings inline, and there are several clever schemes for storing strings even longer than that.

Implementation caveats:

  • On little endian systems, the type tag is in the first byte, leaving the remaining 15 bytes as contiguous storage. Big endian systems are penalized because they have to perform a left or right shift whenever they access or store the type tag. Approximately no one uses BE systems anymore so probably not a huge concern.

  • quickjs.c directly accesses JSString fields all over the place; p->len and p->u.str8 in particular. Adding a layer of indirection introduces some overhead but hopefully that's offset by memory and refcount savings

Lenguaje dominante
C
Estrellas
3.9k
Forks
389
Merge medio
4 d 1 h
PR fusionados (30 d)
24

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 quickjs-ng/quickjs

Todos los issues de quickjs-ng/quickjs

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.