GothicKit / ZenKit

A re-implementation of file formats used by the early 2000's ZenGin
http://zk.gothickit.dev/
MIT License
44 stars 10 forks source link

[v2.0.0] Add benchmarks to allow for proper profiling #12

Open lmichaelis opened 1 year ago

lmichaelis commented 1 year ago

There is probably a lot of performance left on the table at the moment since it is not really possible to profile most parts of phoenix. Especially the script VM is critical to performance in Gothic re-implementations like OpenGothic.

Writing proper benchmarks will enable easier profiling of phoenix.

Try commented 1 year ago

Note about load-time performance: изображение

Animation::Sequence::Sequence in OpenGothic calls for Resources::vdfsIndex().find_entry twice, making total of 18% of load-time.

One fix is easy - use one call, instead of 2 - that is on me. Yet find_entry probably can be improved.

lmichaelis commented 1 year ago

Hm that's an interesting profile. I did one about a week ago and it actually showed that vdf_file::merge takes a long time to run. That is probably related to me using an unsorted Container for vdf_entry::_m_children. I'm looking into a better solution potentially using a set or a list.

lmichaelis commented 1 year ago

As expected, using a std::set with a custom, case-insensitive comparator, I see about 80x performance improvement in find_entry. That's exceptional! I'll have to find a way around std::set's const lookups but it seems like the only right way of doing things is to deprecate the non-const find_entry APIs. They could be re-added in the future because I'm planning a rework of the VDFS API anyways.

lmichaelis commented 1 year ago

@Try I'm keeping a bleeding-edge version of OpenGothic with the newest patches at lmichaelis/OpenGothic in the phoenix-bleeding branch. Feel free to pull/merge from there if you like as well :)

Try commented 1 year ago

Updated OpenGothic - very nice improvement of load-time performance, thanks!