forgottenserver icon indicating copy to clipboard operation
forgottenserver copied to clipboard

Improve OTB loader iteration

Open ranisalt opened this issue 1 year ago • 2 comments

Pull Request Prelude

Changes Proposed

Improves file loader performance by having less indirection and skipping checks aggressively. Loading the map is at least 20% faster (4s -> 3.2s) on my machine using EPuncker/orts2 map.

When running a release build, most of the sanity checks will be skipped (e.g. checking if the file does not underflow, if the nodes have expected types) since we expect map editors to generate correct map files. The map only needs to be loaded once with a debug build if one wants to make sure it works, so there is no need to check again on every start.

ranisalt avatar Sep 25 '24 22:09 ranisalt

Just learned about [[likely]]/[[unlikely]] in C++20 that allows me to keep ifs instead of asserts with virtually no penalty, but with much better error handling (catchable exceptions with meaningful messages)

ranisalt avatar Sep 27 '24 19:09 ranisalt

I'm still working on it to make a single pass loader, it should save a significant amount of time

Edit: but not today

ranisalt avatar Oct 08 '24 20:10 ranisalt

Why does Windows always have to get in the way

ranisalt avatar Sep 01 '25 09:09 ranisalt