noobhack icon indicating copy to clipboard operation
noobhack copied to clipboard

Intrinsics mod

Open CJYate opened this issue 13 years ago • 2 comments

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

CJYate avatar Oct 07 '11 21:10 CJYate

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

samfoo avatar Oct 10 '11 10:10 samfoo

Hi Sam, That's cool, thanks for letting me know.

cheers, Chris

On 10 October 2011 11:50, Sam Gibson [email protected] wrote:

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

Reply to this email directly or view it on GitHub: https://github.com/samfoo/noobhack/pull/16#issuecomment-2345714

CJYate avatar Oct 10 '11 11:10 CJYate