[pseudo] GC GSS nodes, reuse them with a freelist
Most GSS nodes have short effective lifetimes, keeping them around until the end of the parse is wasteful. Mark and sweep them every 20 tokens. When parsing clangd/AST.cpp, this reduces the GSS memory from 1MB to 20kB. We pay ~5% performance for this according to the glrParse benchmark. (Parsing more tokens between GCs doesn't seem to improve this further). Compared to the refcounting approach in https://reviews.llvm.org/D126337, this is simpler (at least the complexity is better isolated) and has >2x less overhead. It doesn't provide death handlers (for error-handling) but we have an alternative solution in mind. Differential Revision: https://reviews.llvm.org/D126723
Loading
Please sign in to comment