最小限のオーバーヘッドのように見えます。私は、次のコードを使用して、いくつかのタイミング・テストを実行した:
ローカル:平均= 00:00:00.0567284、50K = 00:47:共有16.4212917
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()));
それらの結果です。平均= 00:00:00.0568292、50K = 00:47:21.4612018
私の結論は、それは問題ではないということです。
もちろん、ローカルパス経由でファイルにアクセスすると、UNCパスではなく、より高速で効果的になります。どのくらい - もう一つの質問。しかし、より速い – RbMm
はい、私は知っているが、どのくらいの問題です。私はいくつかの実験を行い、その結果はまったく同じです。 – Miguel
おそらく、これはMicrosoftがある時点で曖昧さを解消するため、.Netの場合と同じです。おそらく、これはC、C++でテストしたときとは異なるでしょう。 – Miguel