-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐌 [Performance] Don't spawn new threads in every game loop, just offload it into a ThreadPool
#2747
Comments
good change, as I've had (very rare) cases where TBB malloc fails when creating a new thread for this purpose and crashes (without crashing mangos) |
Interesting that no one catched this earlier. I think this if one of the smaller things that I will tackle after Edit: Okay tests have shown, its not that slow ( |
I run Vmangos in GDB and it spammed my log file with thousands of "New Thread" messages: log entries
Is this the same issue? I had to disable thread-event logging by adding this GDB parameter:
|
Yes, this is also the way how I discovered it. |
🐌 Performance
Currently a new thread is created when
MapManager::Update
invokesCreateNewInstancesForPlayers
.core/src/game/Maps/MapManager.cpp
Line 339 in 645a677
Thread creation should be avoided. Especially that often and for such a small workload.
Its better to off load it into a
ThreadPool
which accepts small tasks like this and processes them with a pre-existing thread.The text was updated successfully, but these errors were encountered: