about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2019-10-08 13:32:59 +1100
committerNicholas Nethercote <nnethercote@mozilla.com>2019-10-08 16:57:29 +1100
commit75e0078a1703448a19e25eac85daaa5a4e6e68ac (patch)
tree4ef94fc1c955d9e508684b8c2fe4854fa624c598 /src/libstd/sys/unix/stack_overflow.rs
parent3832a634d3aa6a7c60448906e6656a22f7e35628 (diff)
downloadrust-75e0078a1703448a19e25eac85daaa5a4e6e68ac.tar.gz
rust-75e0078a1703448a19e25eac85daaa5a4e6e68ac.zip
Optimize `TokenStreamBuilder::push`.
Currently, when two tokens must be glued together, this function duplicates
large chunks of the existing streams. This can cause quadratic behaviour.

This commit changes the function so that it overwrites the last token with a
glued token, which avoids the quadratic behaviour. This removes the need for
`TokenStreamBuilder::push_all_but_{first,last}_tree`.

The commit also restructures `push` somewhat, by removing
`TokenStream::{first_tree_and_joint,last_tree_if_joint}` in favour of more
pattern matching and some comments. This makes the code shorter, and in my
opinion, more readable.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions