DescentDevelopers / Descent3

Descent 3 by Outrage Entertainment
GNU General Public License v3.0
2.88k stars 251 forks source link

Update DDIO and related to it's code OSIRIS #591

Closed winterheart closed 2 months ago

winterheart commented 2 months ago

Pull Request Type

Description

Remove unused functions ddio_GetParentPath() and ddio_CleanPath(). Implement new crossplatform ddio_GetTmpFileName() to replace ddio_GetTempFileName().

Optimize module loading in OSIRIRS: use std::filesystem::path on most parts, change OSIRIS_Extracted_scripts to std::map that removes some fixed size restrictions and optimize search of extracted modules.

Related Issues

Screenshots (if applicable)

Checklist

Additional Comments

winterheart commented 2 months ago

Benchmark of ddio_GetTmpFileName() vs ddio_GetTempFileName() on Linux (Release build):

./ddio_bench --benchmark_repetitions=10
2024-09-17T13:35:02+03:00
Running ./ddio_bench
Run on (12 X 4074.82 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: 0.34, 0.46, 0.88
--------------------------------------------------------------
Benchmark                    Time             CPU   Iterations
--------------------------------------------------------------
ddio_TempOld              2688 ns         2545 ns       271999
ddio_TempOld              2693 ns         2561 ns       271999
ddio_TempOld              2714 ns         2575 ns       271999
ddio_TempOld              3853 ns         3705 ns       271999
ddio_TempOld              5084 ns         4936 ns       271999
ddio_TempOld              5103 ns         4950 ns       271999
ddio_TempOld              5279 ns         5125 ns       271999
ddio_TempOld              5389 ns         5237 ns       271999
ddio_TempOld              5408 ns         5256 ns       271999
ddio_TempOld              5428 ns         5279 ns       271999
ddio_TempOld_mean         4364 ns         4217 ns           10
ddio_TempOld_median       5093 ns         4943 ns           10
ddio_TempOld_stddev       1236 ns         1230 ns           10
ddio_TempOld_cv          28.33 %         29.17 %            10
ddio_TempNew              2071 ns         2070 ns       338686
ddio_TempNew              2068 ns         2066 ns       338686
ddio_TempNew              2067 ns         2066 ns       338686
ddio_TempNew              2069 ns         2068 ns       338686
ddio_TempNew              2068 ns         2067 ns       338686
ddio_TempNew              2064 ns         2063 ns       338686
ddio_TempNew              2068 ns         2067 ns       338686
ddio_TempNew              2063 ns         2062 ns       338686
ddio_TempNew              2071 ns         2070 ns       338686
ddio_TempNew              2070 ns         2069 ns       338686
ddio_TempNew_mean         2068 ns         2067 ns           10
ddio_TempNew_median       2068 ns         2067 ns           10
ddio_TempNew_stddev       2.80 ns         2.75 ns           10
ddio_TempNew_cv           0.14 %          0.13 %            10