erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.63k stars 54 forks source link

Change data structure from `Vec` to `VecDeque` #337

Closed GreasySlug closed 1 year ago

GreasySlug commented 1 year ago

Fixes #292 .

Stream uses Vec, but, using insert(0), remove(0) in this case, it takes O(n) for this process alone every time

In such cases, it is better to use VecDeque, so as for TokenStream, use the Stream implemented by VecDeque

Changes proposed in this PR:

@mtshiba