Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Small string optimization (SSO)

Aperta
#907 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
c
Ambito
performance

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
C
Stelle
3.9k
Fork
389
Merge medio
2g 9h
PR unite (30g)
19

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di quickjs-ng/quickjs

Tutte le issue di quickjs-ng/quickjs

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.