On dirait que la surcharge est minimale. J'ai couru des tests chronométrés en utilisant le code suivant:
var localTimes = new List<long>();
var sharedTimes = new List<long>();
var stopwatch = new Stopwatch();
for (int i = 0; i < 1000; i++)
{
stopwatch.Start();
var bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"E:\Shared\Template.xlsx");
stopwatch.Stop();
localTimes.Add(stopwatch.ElapsedTicks);
stopwatch.Start();
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
bytes = File.ReadAllBytes(@"\\localhost\Shared\Template.xlsx");
stopwatch.Stop();
sharedTimes.Add(stopwatch.ElapsedTicks);
}
Console.WriteLine("Local: avg={0}, 50k={1}", TimeSpan.FromTicks((long)localTimes.Average()/50), TimeSpan.FromTicks(localTimes.Sum()));
Console.WriteLine("Shared: avg={0}, 50k={1}", TimeSpan.FromTicks((long)sharedTimes.Average()/50), TimeSpan.FromTicks(sharedTimes.Sum()));
et ce sont les résultats:
Local: avg = 00: 00: 00,0567284, 50k = 00: 47: 16,4212917
partagés: avg = 00: 00: 00.0568292, 50k = 00: 47: 21.4612018
Mes conclusions sont que cela n'a pas d'importance.
oui, bien sûr, lorsque vous accédez à des fichiers via le chemin local, cela sera plus rapide et plus efficace plutôt que vers un chemin UNC. combien - déjà une autre question. mais plus vite – RbMm
Oui, je sais, mais c'est une question de combien. J'ai fait quelques expériences et les résultats sont assez similaires. – Miguel
Peut-être, c'est seulement comme ça pour .Net parce que Microsoft désambiguise à un moment donné. Peut-être que c'est différent quand testé en C, C++. – Miguel