Replace std::ostringstream in most places by more efficient std::format when C++ 20 is out
Or try {fmt} library - to investigate (std::format is strongly inspired by it but if {fmt} remains more powerful - as indicated on their page if I remember well - might be interesting to use it)