Created
July 26, 2018 04:14
-
-
Save danielplawgo/b9dc8d58935789bdf5eb30bfb0710f97 to your computer and use it in GitHub Desktop.
Jeden czy wiele plików resource, a wydajność
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Benchmarks | |
{ | |
[Benchmark] | |
public void UsingResources() | |
{ | |
var test = Resources.One; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Benchmark] | |
public void UsingResourceManager() | |
{ | |
var resourceManager = Resources.ResourceManager; | |
var test = resourceManager.GetString("One"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Benchmark] | |
public void CreatingResourceManager() | |
{ | |
var resourceManager = | |
new ResourceManager("OneVsManyResourceFiles.Resources", typeof(Resources).Assembly); | |
} | |
[Benchmark] | |
public void CreatingResourceManagerAndGetOneString() | |
{ | |
var resourceManager = | |
new ResourceManager("OneVsManyResourceFiles.Resources", typeof(Resources).Assembly); | |
var test = resourceManager.GetString("One"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Benchmark] | |
public void CreatingResourceManagerAndGetThousandString() | |
{ | |
var resourceManager = | |
new ResourceManager("OneVsManyResourceFiles.Resources", typeof(Resources).Assembly); | |
for (int i = 0; i < 1000; i++) | |
{ | |
var test = resourceManager.GetString("One"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Benchmark] | |
public void ReadManyLanguage() | |
{ | |
var resourceManager = | |
new ResourceManager("OneVsManyResourceFiles.Resources", typeof(Resources).Assembly); | |
var test = resourceManager.GetString("One", CultureInfo.GetCultureInfo("pl-PL")); | |
test = resourceManager.GetString("One", CultureInfo.GetCultureInfo("de-DE")); | |
test = resourceManager.GetString("One", CultureInfo.GetCultureInfo("en-GB")); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134 | |
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores | |
Frequency=3897226 Hz, Resolution=256.5928 ns, Timer=TSC | |
[Host] : .NET Framework 4.6 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3131.0 | |
DefaultJob : .NET Framework 4.6 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3131.0 | |
Method | Mean | Error | StdDev | Median | | |
-------------------------------------------- |--------------:|------------:|------------:|--------------:| | |
UsingResources | 97.55 ns | 1.9698 ns | 4.3237 ns | 95.63 ns | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134 | |
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores | |
Frequency=3897226 Hz, Resolution=256.5928 ns, Timer=TSC | |
[Host] : .NET Framework 4.6 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3131.0 | |
DefaultJob : .NET Framework 4.6 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3131.0 | |
Method | Mean | Error | StdDev | Median | | |
-------------------------------------------- |--------------:|------------:|------------:|--------------:| | |
UsingResources | 97.55 ns | 1.9698 ns | 4.3237 ns | 95.63 ns | | |
UsingResourceManager | 85.96 ns | 0.1613 ns | 0.1509 ns | 85.90 ns | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134 | |
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores | |
Frequency=3897226 Hz, Resolution=256.5928 ns, Timer=TSC | |
[Host] : .NET Framework 4.6 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3131.0 | |
DefaultJob : .NET Framework 4.6 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3131.0 | |
Method | Mean | Error | StdDev | Median | | |
-------------------------------------------- |--------------:|------------:|------------:|--------------:| | |
UsingResources | 97.55 ns | 1.9698 ns | 4.3237 ns | 95.63 ns | | |
UsingResourceManager | 85.96 ns | 0.1613 ns | 0.1509 ns | 85.90 ns | | |
CreatingResourceManager | 2,244.81 ns | 8.3171 ns | 6.9452 ns | 2,242.87 ns | | |
CreatingResourceManagerAndGetOneString | 27,095.96 ns | 94.5670 ns | 88.4580 ns | 27,093.58 ns | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134 | |
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores | |
Frequency=3897226 Hz, Resolution=256.5928 ns, Timer=TSC | |
[Host] : .NET Framework 4.6 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3131.0 | |
DefaultJob : .NET Framework 4.6 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3131.0 | |
Method | Mean | Error | StdDev | Median | | |
-------------------------------------------- |--------------:|------------:|------------:|--------------:| | |
UsingResources | 97.55 ns | 1.9698 ns | 4.3237 ns | 95.63 ns | | |
UsingResourceManager | 85.96 ns | 0.1613 ns | 0.1509 ns | 85.90 ns | | |
CreatingResourceManager | 2,244.81 ns | 8.3171 ns | 6.9452 ns | 2,242.87 ns | | |
CreatingResourceManagerAndGetOneString | 27,095.96 ns | 94.5670 ns | 88.4580 ns | 27,093.58 ns | | |
CreatingResourceManagerAndGetThousandString | 111,263.32 ns | 413.9859 ns | 366.9877 ns | 111,085.54 ns | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134 | |
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores | |
Frequency=3897226 Hz, Resolution=256.5928 ns, Timer=TSC | |
[Host] : .NET Framework 4.6 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3131.0 | |
DefaultJob : .NET Framework 4.6 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3131.0 | |
Method | Mean | Error | StdDev | Median | | |
-------------------------------------------- |--------------:|------------:|------------:|--------------:| | |
UsingResources | 97.55 ns | 1.9698 ns | 4.3237 ns | 95.63 ns | | |
UsingResourceManager | 85.96 ns | 0.1613 ns | 0.1509 ns | 85.90 ns | | |
CreatingResourceManager | 2,244.81 ns | 8.3171 ns | 6.9452 ns | 2,242.87 ns | | |
CreatingResourceManagerAndGetOneString | 27,095.96 ns | 94.5670 ns | 88.4580 ns | 27,093.58 ns | | |
CreatingResourceManagerAndGetThousandString | 111,263.32 ns | 413.9859 ns | 366.9877 ns | 111,085.54 ns | | |
ReadManyLanguage | 89,069.69 ns | 402.8163 ns | 357.0861 ns | 88,993.29 ns | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment