diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-09-17 12:08:24 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-09-17 15:32:29 +1000 |
| commit | 476e75ded71ad6f573daabe2ca7a1be9fe3ce3cb (patch) | |
| tree | 94837a6293297f33ef727e4bd263bc4407504aca /src/libsyntax/parse/parser/expr.rs | |
| parent | 5670d048c0f88af9976b5505c7853b23dd06770d (diff) | |
| download | rust-476e75ded71ad6f573daabe2ca7a1be9fe3ce3cb.tar.gz rust-476e75ded71ad6f573daabe2ca7a1be9fe3ce3cb.zip | |
Move a `Node`'s parent into the descendents list.
`Node` has an optional parent and a list of other descendents. Most of the time the parent is treated the same as the other descendents -- error-handling is the exception -- and chaining them together for iteration has a non-trivial cost. This commit changes the representation. There is now a single list of descendants, and a boolean flag that indicates if there is a parent (in which case it is first descendent). This representation encodes the same information, in a way that is less idiomatic but cheaper to iterate over for the common case where the parent doesn't need special treatment. As a result, some benchmark workloads are up to 2% faster.
Diffstat (limited to 'src/libsyntax/parse/parser/expr.rs')
0 files changed, 0 insertions, 0 deletions
