gleam-lang/gleam

Use memory arena for types when type checking

Open

#2.250 geöffnet am 29. Juni 2023

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (960 Forks)batch import
help wanted

Repository-Metriken

Stars
 (21.417 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 10T 19h) (69 gemergte PRs in 30 T)

Beschreibung

Currently, we represent types using a nested tree structure in which nodes are reference counted. This is at times awkward to work with, not particularly well-suited to a multithreaded compilation, and potentially slower than using an arena due to the overhead of reference, counting and memory fragmentation. Use an id based memory arena instead.

It is only during type interference and checking that we need to mutate types and to have the various different kinds of type variables, so for all other parts of the compiler, we can have a different, simpler data structure with which to represent types. Related to https://github.com/gleam-lang/gleam/issues/865

Contributor Guide