Do not update/redraw windows and viewports in dedicated mode.

This has a quite significant performance cost when the result will
only be thrown away by the null blitter anyway.
No longer call UpdateWindows in main loop, which renders
dirty windows and viewports.
No longer update vehicle sprites IDs or mark dirty vehicles in viewports.
This saved >50% of server CPU time in a test game.
This commit is contained in:
Jonathan G Rennison
2015-11-25 22:36:57 +00:00
parent 781c34882e
commit 352a3229cd
2 changed files with 3 additions and 1 deletions

View File

@@ -24,6 +24,7 @@
#include "group_type.h"
#include "timetable.h"
#include "base_consist.h"
#include "network/network.h"
#include <list>
#include <map>
@@ -1138,6 +1139,8 @@ struct SpecializedVehicle : public Vehicle {
*/
inline void UpdateViewport(bool force_update, bool update_delta)
{
if (_network_dedicated) return;
/* Explicitly choose method to call to prevent vtable dereference -
* it gives ~3% runtime improvements in games with many vehicles */
if (update_delta) ((T *)this)->T::UpdateDeltaXY(this->direction);

View File

@@ -315,7 +315,6 @@ void VideoDriver_Dedicated::MainLoop()
next_tick = cur_ticks + MILLISECONDS_PER_TICK;
GameLoop();
UpdateWindows();
}
/* Don't sleep when fast forwarding (for desync debugging) */