mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Tests
This commit is contained in:
parent
4a32fc1415
commit
c8330a47a2
17
BSA-speedtest/BSA-speedtest.csproj
Normal file
17
BSA-speedtest/BSA-speedtest.csproj
Normal 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
30
BSA-speedtest/Program.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
@ -398,14 +398,14 @@ namespace Wabbajack.Common
|
||||
{
|
||||
var path = _path;
|
||||
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()
|
||||
{
|
||||
var path = _path;
|
||||
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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user