"Flattening ASTs" is the term Adrian Sampson gives to making an array of structs (well, unions of structs) to hold your AST, with references to earlier AST nodes represented as array indices. He claims that this gives a 2.4× #performance boost in his AST-walking interpreter microbenchmark in #Rust, due to improved spatial locality, smaller references, pointer-bumping allocation, and cheap deallocation. He also tried out iterating over the array of AST nodes to compute all their values. #compact-ASTs
on 02023-07-04