Open bovine3dom opened 5 years ago
Merged @synixebrett's little sanity changes (thanks!).
bash-5.0$ time ~/projects/armake2/target/release/armake2 preprocess addons/weapon_rifle_blank_c/config.cpp > master
real 0m0.684s
user 0m0.619s
sys 0m0.064s
bash-5.0$ time ~/projects/armake2/target/release/armake2 preprocess addons/weapon_rifle_blank_c/config.cpp > iterated
real 0m0.655s
user 0m0.617s
sys 0m0.037s
Switched to loop for reduction and tested on "release" build. Still no slowdown.
Disclaimer: I don't "get" Rust so a lot of what I do here might be mad. I probably listen to the compiler a little too much.
To my surprise, the PR does work.
Summary of changes:
preprocess_rec
out into theline_muncher
functionPreprocessHolder
, that calls theline_muncher
function and keeps track of the current linepreprocess_rec
use that iteratorMotivation: https://github.com/synixebrett/HEMTT/pull/57
Even on a large config, it hasn't degraded performance:
The final loop could obviously be replaced with a
fold
if you're so inclined.I'd appreciate someone who knows what they're doing looking over this - the dereferences everywhere look like an anti-pattern, for example. Also, help with naming things would be useful.
I'm happy to tidy the PR up before (if?) it is merged.