diff --git a/BSA-speedtest/BSA-speedtest.csproj b/BSA-speedtest/BSA-speedtest.csproj new file mode 100644 index 00000000..ac03161d --- /dev/null +++ b/BSA-speedtest/BSA-speedtest.csproj @@ -0,0 +1,17 @@ + + + + Exe + net5.0-windows + BSA_speedtest + win10-x64 + 8.0 + enable + + + + + + + + diff --git a/BSA-speedtest/Program.cs b/BSA-speedtest/Program.cs new file mode 100644 index 00000000..1d61409a --- /dev/null +++ b/BSA-speedtest/Program.cs @@ -0,0 +1,30 @@ +using System; +using System.Diagnostics; +using System.Linq; +using Compression.BSA; +using Wabbajack.Common; + +namespace BSA_speedtest +{ + class Program + { + static void Main(string[] args) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + for (int i = 0; i < 10000; i++) + { + var bsa = BSAReader.Load(new AbsolutePath(@"G:\Skyrim - Textures3.bsa")); + var files = bsa.Files.ToArray(); + var names = files.Select(f => f.Path.ToString()).ToArray(); + if (i % 100 == 0) + { + System.Console.WriteLine(i); + } + } + sw.Stop(); + System.Console.WriteLine($"{sw.ElapsedMilliseconds}ms"); + System.Console.ReadLine(); + } + } +} diff --git a/Wabbajack.Common/Paths/AbsolutePath.cs b/Wabbajack.Common/Paths/AbsolutePath.cs index 26d8a27e..5d331494 100644 --- a/Wabbajack.Common/Paths/AbsolutePath.cs +++ b/Wabbajack.Common/Paths/AbsolutePath.cs @@ -398,14 +398,14 @@ namespace Wabbajack.Common { var path = _path; return CircuitBreaker.WithAutoRetryAsync(async () => - File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, bufferSize: 1048576, useAsync: true)); + File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, bufferSize: 1048576, useAsync: false)); } public ValueTask WriteShared() { var path = _path; return CircuitBreaker.WithAutoRetryAsync(async () => - File.Open(path, FileMode.Open, FileAccess.Write, FileShare.ReadWrite, bufferSize: 1048576, useAsync: true)); + File.Open(path, FileMode.Open, FileAccess.Write, FileShare.ReadWrite, bufferSize: 1048576, useAsync: false)); } public async Task CopyDirectoryToAsync(AbsolutePath destination) diff --git a/Wabbajack.sln b/Wabbajack.sln index bcd18b18..9277b3f1 100644 --- a/Wabbajack.sln +++ b/Wabbajack.sln @@ -44,6 +44,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.Server", "Wabbaja EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.Server.Test", "Wabbajack.Server.Test\Wabbajack.Server.Test.csproj", "{9DEC8DC8-B6E0-469B-9571-C4BAC0776D07}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BSA-speedtest", "BSA-speedtest\BSA-speedtest.csproj", "{8F2BE353-6CFF-461B-A7B3-C41845C5977A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -165,6 +167,14 @@ Global {9DEC8DC8-B6E0-469B-9571-C4BAC0776D07}.Release|Any CPU.Build.0 = Release|Any CPU {9DEC8DC8-B6E0-469B-9571-C4BAC0776D07}.Release|x64.ActiveCfg = Release|Any CPU {9DEC8DC8-B6E0-469B-9571-C4BAC0776D07}.Release|x64.Build.0 = Release|Any CPU + {8F2BE353-6CFF-461B-A7B3-C41845C5977A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F2BE353-6CFF-461B-A7B3-C41845C5977A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F2BE353-6CFF-461B-A7B3-C41845C5977A}.Debug|x64.ActiveCfg = Debug|Any CPU + {8F2BE353-6CFF-461B-A7B3-C41845C5977A}.Debug|x64.Build.0 = Debug|Any CPU + {8F2BE353-6CFF-461B-A7B3-C41845C5977A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8F2BE353-6CFF-461B-A7B3-C41845C5977A}.Release|Any CPU.Build.0 = Release|Any CPU + {8F2BE353-6CFF-461B-A7B3-C41845C5977A}.Release|x64.ActiveCfg = Release|Any CPU + {8F2BE353-6CFF-461B-A7B3-C41845C5977A}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE