Preallocate parser::Input

This commit is contained in:
Chayim Refael Friedman 2025-04-25 17:18:14 +03:00
parent 5ff4ba347d
commit 8bff414abc
3 changed files with 10 additions and 3 deletions

View file

@ -27,7 +27,7 @@ pub enum StrStep<'a> {
impl LexedStr<'_> {
pub fn to_input(&self, edition: Edition) -> crate::Input {
let _p = tracing::info_span!("LexedStr::to_input").entered();
let mut res = crate::Input::default();
let mut res = crate::Input::with_capacity(self.len());
let mut was_joint = false;
for i in 0..self.len() {
let kind = self.kind(i);