Ulf Adams recently (2018) shown outstanding algorithm Ryu that converts a floating point number to its shortest decimal representation. It’s currently the fastest known float-to-string conversion algorithm.
Stephan T. Lavavej showed at CppCon 2019 how he implemented <charconv> in msvc’s stl lib using that algorithm.
I am not home now, but I comment so I can remember to test it when I get there.
I believe just by switching the stringstream for a direct access you will get much faster times.
Probably std::stoi would be faster you mean? But you have to loop that right?