rynorris / goBrains

Real-time neural network controlled creatures. Implemented in go.
MIT License
11 stars 3 forks source link

Entitymanager should be multi-threaded to improve performance #8

Closed rynorris closed 10 years ago

rynorris commented 10 years ago

Most of what EM does is thread-safe. The Check() method of entities should be split into two methods, Check() and Work(). Work() should guarentee to be threadsafe, and Check() should do any unsafe teardown actions. This way, Work() can be called for each entity concurrently, and then just a quick spin through Check() made afterwards to clean up dead entities. This will improve performance. Potentially by a lot.

rynorris commented 10 years ago

Done. Got a ~2.5x perf boost on my system. ;D