safeGetline() already clears the string buffer before writing to it, so
the same buffer can be used multiple times, but the loops calling
safeGetline() have the string scoped within the loop, so its
constructed and destructed in each loop iteration, causing lots of
unnecessary allocations.
Parse times for some large .obj files (without asan):
File A File B File C
Before 2743ms 589ms 615ms
After 2500ms 573ms 545ms
45 KiB
45 KiB