Yes, this is exactly what I do now =) Just wondering, maybe there is a less messy solution.
|Any conversion you do will pale into insignificance compared to the speed of reading from file.|
That was exactly what I thought! Imagine how surprised I was when I discovered that parsing doubles with
eats more then 95% of the time (on my system in one specific example). Maybe it is because I test on high-end NVMe though, or thanks to ram-caching, I don't know. Anyway, with
I get about 250 MB/sec with small text files, which is totally ok. With
a lot less.
Thanks! C++17 from_chars(), ok, looks good!
I do not exactly control the files. They are relatively small jsons with messy entries like that:
"values_min_max" : ["12.345 24.567", "12.345 nan"],
So, after parsing json I do need to parse these space-separated strings with doubles.
About binary files: that is exactly what I do =) Trying to convert these messy jsons to binary format. It is one-time operation (sort of), so I don't need a blazing fast optimization. But I just was confused with
performance, so want to know some solutions for future. And I don't want to wait 5 seconds every time I run a program during development now.