mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +00:00
STOPWATCH
This commit is contained in:
parent
580d5eb8a4
commit
09ff2b540e
@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Mirror.RemoteCalls;
|
||||
using UnityEngine;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
namespace Mirror
|
||||
{
|
||||
@ -1810,6 +1812,7 @@ static void FlushConnections()
|
||||
internal static readonly List<NetworkConnectionToClient> connectionsCopy =
|
||||
new List<NetworkConnectionToClient>();
|
||||
|
||||
static Stopwatch watch = new Stopwatch();
|
||||
static void Broadcast()
|
||||
{
|
||||
// copy all connections into a helper collection so that
|
||||
@ -1823,12 +1826,16 @@ static void Broadcast()
|
||||
connectionsCopy.Clear();
|
||||
connections.Values.CopyTo(connectionsCopy);
|
||||
|
||||
watch.Restart();
|
||||
|
||||
// broadcast spawned entities
|
||||
BroadcastDirtySpawned();
|
||||
|
||||
// flush all connection's batched messages
|
||||
FlushConnections();
|
||||
|
||||
Debug.Log($"Broadcast took {watch.Elapsed.TotalMilliseconds:F1} ms");
|
||||
|
||||
// TODO this is way too slow because we iterate ALL spawned :/
|
||||
// TODO this is way too complicated :/
|
||||
// to understand what this tries to prevent, consider this example:
|
||||
|
Loading…
Reference in New Issue
Block a user