Open winterheart opened 6 days ago
You can do something like that to fix mac os CI (but cleaner). strncpy
is problematic https://github.com/Lgt2x/Descent3/commit/15a50ca126b7da7504f6f2328bd6622d65463b71#diff-be34739991a103c73033e6358b31b2a8d7859b7a5c84616dcf1409176168f55d
After some refactoring cf_FindRealFileNameCaseInsensitive() now works much faster and more reliable. Here some benchmarks:
Release:
2024-07-02T20:08:56+03:00
Running ./cfile_bench
Run on (12 X 4300 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x6)
L1 Instruction 32 KiB (x6)
L2 Unified 256 KiB (x6)
L3 Unified 12288 KiB (x1)
Load Average: 2.82, 1.81, 1.42
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
-------------------------------------------------------------------
Benchmark Time CPU Iterations
-------------------------------------------------------------------
cfile_no_exist_old 11384 ns 11065 ns 63154
cfile_no_exist_new 9812 ns 9613 ns 74990
cfile_exist_relative_old 2682 ns 2452 ns 258570
cfile_exist_relative_new 926 ns 925 ns 784549
cfile_exist_absolute_old 3422 ns 3132 ns 222331
cfile_exist_absolute_new 1222 ns 1220 ns 585813
Debug:
2024-07-02T20:09:47+03:00
Running ./cfile_bench
Run on (12 X 4300 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x6)
L1 Instruction 32 KiB (x6)
L2 Unified 256 KiB (x6)
L3 Unified 12288 KiB (x1)
Load Average: 2.21, 1.81, 1.45
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
-------------------------------------------------------------------
Benchmark Time CPU Iterations
-------------------------------------------------------------------
cfile_no_exist_old 11768 ns 11426 ns 61555
cfile_no_exist_new 13682 ns 13423 ns 53839
cfile_exist_relative_old 3147 ns 2907 ns 224424
cfile_exist_relative_new 1591 ns 1588 ns 427936
cfile_exist_absolute_old 4179 ns 3893 ns 183101
cfile_exist_absolute_new 2132 ns 2129 ns 319614
Pull Request Type
Description
This PR updates cfile and partially ddio modules to use C++17's
std::filesystem::path
feature, which simplifies overall filesystem operations.Some parts of code was migrated, and there some performance improvements was achieved. Internally cfile maintains some sort search paths. Old code was excessively added some non-existent paths, and on opening files these paths was pointlessly used. Also there some code optimization in
cf_FindRealFileNameCaseInsenstive()
was performed.Added unittest framework for cfile.
Related Issues
Screenshots (if applicable)
Checklist
Additional Comments