Closed dmarszk closed 8 years ago
Oh my, you're tackling this?! Good on you. I've just left it as is and allow the pointer creation to be in one thread and the deletion to be in another 'cause changing it is a lot of work :p I may help you out though as it will be better this way. If it helps at all, the first byte of name is 0 for an uninitialized CTibiaCharacter.
Yeah it struck me that profiling have shown about 40% of the CPU time being spend in memory read functions during map research. I'm still figuring out the best way to optimize it.
This looks nice. By how much percentage is this going to improve TA? :D
Well, if it ever gets to an optimal implementation - it should cut CPU usage between 30% and half.
Wow... That would be awesome! :D
RFC. I applied some fixes regarding the aferomentioned issues. I tried to do it as simple as possible.
Roughly... I believe it will make at least 90% less ReadProcessMemory calls. It's possible that there's a more optimal MEMORY_CACHE_ENTRY_SIZE value. Of course the whole bunch of scanning algorithms are broken by design in this case and could be done better, but it's the simplest way to speed them up.
Identified two main bottlenecks: