accncc / lidgren-network-gen3

Automatically exported from code.google.com/p/lidgren-network-gen3
0 stars 0 forks source link

NetServer.SendToAll(NetOutgoingMessage msg, NetConnection except, NetDeliveryMethod method, int sequenceChannel) #98

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Small optimisation.

current:
List<NetConnection> recipients = new List<NetConnection>(all.Count - 1);
foreach (var conn in all)
  if (conn != except)
    recipients.Add(conn);

need:
if ( except != null ) {
  int idx = all.IndexOf(except);
  if ( idx != -1 )
    all.RemoveAt(idx);
}

Original issue reported on code.google.com by x000...@gmail.com on 9 Dec 2011 at 5:57

GoogleCodeExporter commented 9 years ago
I do not want to modify the list of connections passed to this method; it might 
suprise callers.
I did check in a miniscule optimization tho in cases where 'except' is null; 
rev 276.

Original comment by lidg...@gmail.com on 9 Dec 2011 at 9:13