When profiling my game I found a big spike when initializing a dialogue that came from an anonymous lambda being called 500+ times in one frame.
I traced this back to the resolve_thing_method() function in DialogueManager. It uses a filter on a get_method_list array to find the method with the correct name. It seems that can get slow when done for a lot of different methods, so I made a new method that caches the needed information to a dictionary the first time it runs, and uses the cached information in subsequent calls if it's already cached or adds to the cache if it isn't.
This change greatly alleviated the big lag spike I was experiencing.
No tests failed, and no change is needed to the documentation.
When profiling my game I found a big spike when initializing a dialogue that came from an anonymous lambda being called 500+ times in one frame.
I traced this back to the
resolve_thing_method()
function in DialogueManager. It uses a filter on a get_method_list array to find the method with the correct name. It seems that can get slow when done for a lot of different methods, so I made a new method that caches the needed information to a dictionary the first time it runs, and uses the cached information in subsequent calls if it's already cached or adds to the cache if it isn't.This change greatly alleviated the big lag spike I was experiencing.
No tests failed, and no change is needed to the documentation.