This commit is contained in:
Justin Swanson 2021-01-15 18:53:30 -06:00
parent 4a32fc1415
commit c8330a47a2
4 changed files with 59 additions and 2 deletions

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<RootNamespace>BSA_speedtest</RootNamespace>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Compression.BSA\Compression.BSA.csproj" />
<ProjectReference Include="..\Wabbajack.Common\Wabbajack.Common.csproj" />
</ItemGroup>
</Project>

30
BSA-speedtest/Program.cs Normal file
View File

@ -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();
}
}
}

View File

@ -398,14 +398,14 @@ namespace Wabbajack.Common
{ {
var path = _path; var path = _path;
return CircuitBreaker.WithAutoRetryAsync<FileStream, IOException>(async () => return CircuitBreaker.WithAutoRetryAsync<FileStream, IOException>(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<FileStream> WriteShared() public ValueTask<FileStream> WriteShared()
{ {
var path = _path; var path = _path;
return CircuitBreaker.WithAutoRetryAsync<FileStream, IOException>(async () => return CircuitBreaker.WithAutoRetryAsync<FileStream, IOException>(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) public async Task CopyDirectoryToAsync(AbsolutePath destination)

View File

@ -44,6 +44,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.Server", "Wabbaja
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.Server.Test", "Wabbajack.Server.Test\Wabbajack.Server.Test.csproj", "{9DEC8DC8-B6E0-469B-9571-C4BAC0776D07}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.Server.Test", "Wabbajack.Server.Test\Wabbajack.Server.Test.csproj", "{9DEC8DC8-B6E0-469B-9571-C4BAC0776D07}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BSA-speedtest", "BSA-speedtest\BSA-speedtest.csproj", "{8F2BE353-6CFF-461B-A7B3-C41845C5977A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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|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.ActiveCfg = Release|Any CPU
{9DEC8DC8-B6E0-469B-9571-C4BAC0776D07}.Release|x64.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE