gleam-lang/gleam

Use memory arena for types when type checking

Open

#2250 aperta il 29 giu 2023

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Rust (960 fork)batch import
help wanted

Metriche repository

Star
 (21.417 star)
Metriche merge PR
 (Merge medio 10g 19h) (69 PR mergiate in 30 g)

Descrizione

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

Guida contributor