Closed GreasySlug closed 1 year ago
Currently the tokenStream uses Vec This method has self.lpop() and self.skip
self.lpop()
self.skip
#[inline] fn skip(&mut self) { self.tokens.remove(0); } #[inline] fn lpop(&mut self) -> Token { self.tokens.remove(0) }
This self.remove(0) calculation cost is O(n) For short scripts, the computational cost is not a problem, but for scripts with more than 5k lines, the Parser starts to take a long time to process.
self.remove(0)
Parser
It would be more efficient to replace structures other than TokenStream that use Vec internally to perform remove(0) with VecDeque.
TokenStream
Vec
remove(0)
VecDeque
Currently the tokenStream uses Vec This method has
self.lpop()
andself.skip
This
self.remove(0)
calculation cost is O(n) For short scripts, the computational cost is not a problem, but for scripts with more than 5k lines, theParser
starts to take a long time to process.