From 4d011687e5e65b97168610659bc79330983cf59b Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 25 Aug 2026 15:41:40 +0200 Subject: perf(engine): optimize wavefront obj parsing --- engine/src/file_format/wavefront/common.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'engine/src/file_format/wavefront/common.rs') diff --git a/engine/src/file_format/wavefront/common.rs b/engine/src/file_format/wavefront/common.rs index 8cdfb34..83fd8af 100644 --- a/engine/src/file_format/wavefront/common.rs +++ b/engine/src/file_format/wavefront/common.rs @@ -1,5 +1,7 @@ use std::num::{ParseFloatError, ParseIntError}; +use engine_ecs::util::array_vec::ArrayVec; + macro_rules! keyword { ( $(#[$attr: meta])* @@ -68,9 +70,11 @@ where let mut parts = line.split(' '); let keyword = KeywordT::from_str(parts.next().unwrap(), line_no)?; - let arguments = parts - .map(|part| Value::parse::(part, line_no)) - .collect::, _>>()?; + let mut arguments = ArrayVec::::default(); + + for part in parts { + arguments.push(Value::parse::(part, line_no)?); + } Ok(Some(Statement { keyword, arguments })) } @@ -265,7 +269,7 @@ impl Value pub struct Statement { pub keyword: KeywordT, - pub arguments: Vec, + pub arguments: ArrayVec, } impl Statement -- cgit v1.2.3-18-g5258