Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text format (e.g. IridasCube) parsing optimizations #2074

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Commits on Oct 1, 2024

  1. Iridas .cube and other text format parsing optimizations

    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" .cube file (5.4MB)
    on Ryzen 5950X / VS2022 Release build: 167ms -> 123ms.
    
    - Add locale independent IsSpace(char). Somewhat similar to 3aab90d,
      whitespace trimming perhaps should not be locale dependent.
    - Add IsEmptyOrWhiteSpace() and use that inside ParseUtils::nextline,
      instead of doing Trim(line).empty().
    - Add StringUtils::StartsWith(char) and use that in various parsers
      that were constructing whole std::string object just to check for a
      single character.
    - When building for C++17 or later, 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 with errno or locales. Saves
      some thread local storage accesses and function calls (e.g. on Windows
      errno is actually a function call).
    - There's a CMake setup change that adds /Zc:__cplusplus flag for MSVC;
      for backwards compat reasons it does not report proper C++ version
      detection defines otherwise.
    
    Signed-off-by: Aras Pranckevicius <[email protected]>
    aras-p committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    769e887 View commit details
    Browse the repository at this point in the history
  2. Fix test failures (char can be signed, doh)

    Signed-off-by: Aras Pranckevicius <[email protected]>
    aras-p committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    74b465a View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2024

  1. Tests: add unit test coverage for NumberUtils::from_chars directly

    Currently it was only tested indirectly via XMLReaderUtils_tests and
    file format tests
    
    Signed-off-by: Aras Pranckevicius <[email protected]>
    aras-p committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    8f5be6a View commit details
    Browse the repository at this point in the history
  2. Fix from_chars in C++17 code path to understand hex prefix (0x) and s…

    …kip optional whitespace
    
    To match the pre-C++17 behavior that was there before
    
    Signed-off-by: Aras Pranckevicius <[email protected]>
    aras-p committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    8428381 View commit details
    Browse the repository at this point in the history
  3. Fix detection of <charconv> float from_chars availability

    Signed-off-by: Aras Pranckevicius <[email protected]>
    aras-p committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    3353ac4 View commit details
    Browse the repository at this point in the history
  4. Tests: Fix missing <limits> include for gcc

    Signed-off-by: Aras Pranckevicius <[email protected]>
    aras-p committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    3f65bb3 View commit details
    Browse the repository at this point in the history
  5. Tests: fix uninitialized variable warning-as-error on gcc

    Signed-off-by: Aras Pranckevicius <[email protected]>
    aras-p committed Oct 2, 2024
    Configuration menu
    Copy the full SHA
    53fbca9 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2024

  1. Configuration menu
    Copy the full SHA
    27f8ab7 View commit details
    Browse the repository at this point in the history