2017-08-17 3 views
0

多くの場所でホストされているテンプレートファイルがいくつかあります。主な理由は、各モジュールに対してローカルにアクセスできるテンプレートです。ローカルパスまたはUNC共有パスを使用してファイルにアクセスする場合のパフォーマンスに違いがありますか。

後で、これらのファイルが各ボックスのUNC共有パスを通じて使用されていることがわかりました。

私の質問は: は、ローカルパス経由ではなく、UNCパスにローカルファイルへのアクセスとの間のパフォーマンスの違いはありますか?

+0

もちろん、ローカルパス経由でファイルにアクセスすると、UNCパスではなく、より高速で効果的になります。どのくらい - もう一つの質問。しかし、より速い – RbMm

+0

はい、私は知っているが、どのくらいの問題です。私はいくつかの実験を行い、その結果はまったく同じです。 – Miguel

+0

おそらく、これはMicrosoftがある時点で曖昧さを解消するため、.Netの場合と同じです。おそらく、これはC、C++でテストしたときとは異なるでしょう。 – Miguel

答えて

1

最小限のオーバーヘッドのように見えます。私は、次のコードを使用して、いくつかのタイミング・テストを実行した:

ローカル:平均= 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

私の結論は、それは問題ではないということです。

関連する問題