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:
@@ -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);
|
||||
|
@@ -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) */
|
||||
|
Reference in New Issue
Block a user