Conversation
…ntrinsics and if it works, roll into other dispatch methods. This is intermediate checkin and breaks the functionality temporarily.
…as causing a perfomance issue.
…essages, in case the message goes across multiple lines.
intrinsics.py : Since we're now looking at regex search we don't want full stops in the search strings - removed. Also removed are exclamation marks. setup.py : modified the Extensions build info to link against libboost_regex
|
For the moment I'm going to let this sit in limbo. I have a big change coming through (previewed on the proper-mapping) branch that I'd like to finish for 0.3, then make this (and other perf improvements) part of the upcoming (heretofore non-existant) 0.4 branch. Hopefully I'll be able to finish proper-mapping this week and then merge 0.3 back to master at which point this commit will be the start of the new dev branch. Sam |
|
Hi Sam, That's cool, thanks for letting me know. cheers, On 10 October 2011 11:50, Sam Gibson
|
Hi,
I found the searches done in Brain.py to look for intrinsic gained/lost messages were slowing down the game considerably in some circumstances (especially when entering long-ish lines in the console; e.g. specifying wishes, naming items or engraving messages).
The search code was basically looping through Dictionaries of Dictionaries in Python, then applying a regex search to the results. To speed things up I've reimplemented the searching code in C++ with some pre-caching of the search terms and results, which seems to significantly improve performance.
This could be extended to the other dispatch functions (e.g. _dispatch_status_events() -- if the Brain gets cleverer more functionality might need to be compiled into modules.
Regular Expressions searching is handled using Boost::Regex -- I hope that dependency isn't a problem. Boost is easily installable through aptitude or similar.
cheers,
Chris