Open aras-p opened 1 month ago
Apologies for the delay in CI @aras-p, we have to manually approve the workflows due to our current GitHub settings. Trying to see if we can update that or merge your other PR which should also work.
@remia thanks! I admit I did not expect that this PR would need so many failed iterations. <charconv>
is a tough beast, it seems :)
Doing some test on an Intel MBP, Xcode 16, it seems to still not support from_chars()
Yeah, Apple's Clang/STL keeps on being "special". Some other software (e.g. Blender) works around this whole issue by embedding https://github.com/fastfloat/fast_float and using that instead of <charconv>
Primarily driven by a wish to increase performance of parsing .cube files. But the functions that are added or changed are used across parsing of all/most of text based formats.
With these changes, parsing "Khronos PBR Neutral" Iridas .cube file (5.4MB) on Ryzen 5950X / VS2022 Release build: 167ms -> 126ms. Parsing the same file in CLF format: 150ms -> 137ms.
What the PR does is:
IsSpace(char)
. Somewhat similar to 3aab90d31, whitespace trimming perhaps should not be locale dependent.IsEmptyOrWhiteSpace()
and use that insideParseUtils::nextline
, instead of doingTrim(line).empty()
.StringUtils::StartsWith(char)
and use that in various parsers that were constructing wholestd::string
object just to check for a single character.NumberUtils
can use standard<charconv>
from_chars
functions (except on Apple platforms, where those are not implemented for floating point types as of Xcode 15). This has advantage of not having to deal witherrno
or locales. Saves some thread local storage accesses and function calls (e.g. on Windowserrno
is actually a function call).NumberUtils::from_chars
was only indirectly covered by tests, and as XML parser utils tests point out, it should be able to handle hex floats and so on. So all that is implemented there, and explicitly covered bytests/utils/NumberUtils_tests.cpp
./Zc:__cplusplus
flag for MSVC; for backwards compat reasons it does not report proper C++ version detection defines otherwise.