Open hzeller opened 1 year ago
In #1483 the leaf and node have been made final, so it is documented that these are the only ones interesting.
In #1648 the SymbolPtr
was moved to a single place, as preparation for some potential different way of managing instances.
When running a simple parsing (
verible-verilog-syntax
), the destructor ofSyntaxTreeNode
uses up about 15%-ish CPU. It has to destruct a vector with all their children. The whole tree is deallocated recursively, which means calling destructors of many small std::vectors.Ideally, we shouldn't have to worry about destructing a syntax tree recursively. If we can allocate everything in an arena and deallocate at once, this would be a
O(1)
operation. Also, allocation would be cheaper.Maybe
std::vector
can be an array (if we know the size at allocation time, this would be an excellent use of a flexible array member which would work well with arena allocation).