David H. Flint opened merge request !420: Make server startup faster at Scribble / GDLEnhanced2

David H. Flint
2019-05-03T00:41:53Z

This significantly improves the time that it takes for the server to startup.

Set _ITERATOR_DEBUG_LEVEL to 0 to disable STL debugging iterators. This makes a huge difference in Debug builds due to the heavy reliance of nlohmann json on the STL.

Update m_WeenieDefaultsByName from LocalStorage by searching for the insertion point with equal_range. This changes a linear insertion to a log insertion.

Cache the dungeon drop locations rather than reparsing client_cell_1.dat on every server start. This removes several seconds of startup time even in Release builds.

Make startup logging more verbose, with additional timing information for reference.

Together, these changes mean that loading weenies from LocalStorage can take less than 10 seconds in Debug builds and less than a second in Release builds when the files are cached in memory.

I've tested further optimizations, but there are diminishing returns and they involve larger code changes. In particular, ThreadedFileLoader should use a thread pool rather than spawning a thread for every .json file to avoid the overhead of thread creation and destruction. File loading and file processing should then be done by separate threads since CreateFile and ReadFile block. Inferred data can also be loaded in parallel.