This file contains 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
dotnet build -c Release | |
Run-PerformanceTest.cmd net6.0 | |
Run-PerformanceTest.cmd net5.0 | |
Run-PerformanceTest.cmd netcoreapp3.1 |
This file contains 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
set DOTNET_ReadyToRun=0 | |
set DOTNET_TieredPGO=1 | |
set DOTNET_TC_QuickJitForLoops=1 |
This file contains 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
# Copy the text below to BeatSaberLauncher.ps1 | |
# You may need to edit the path below | |
# The default Beat Saber location for Steam version: | |
Set-Location -Path "C:\Program Files\Steam\steamapps\common\Beat Saber" | |
# The default Beat Saber location for Oculus version: | |
# Set-Location -Path "C:\Program Files\Oculus\Software\Software\hyperbolic-magnetism-beat-saber" | |
Start-Process -FilePath "Beat Saber.exe" | |
Write-Output "Beat Saber started." |
This file contains 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
@rem Copy this text to BeatSaberLauncher.bat & use it to start Beat Saber | |
@start "Beat Saber Launcher" powershell.exe -File BeatSaberLauncher.ps1 |
This file contains 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 static long ComputeSumMMF(string fileName, | |
Func<IntPtr, long, long, int, (long, int)> sumComputer) | |
{ | |
using var f = MemoryMappedFile.CreateFromFile(fileName, FileMode.Open); | |
using var fAccessor = f.CreateViewAccessor(); | |
var fHandle = fAccessor.SafeMemoryMappedViewHandle; | |
var (sum, _) = sumComputer(fHandle.DangerousGetHandle(), (long) fHandle.ByteLength, 0, 0); | |
return sum; | |
} |
This file contains 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
private static unsafe (long, int) ComputeSumSimd( | |
ReadOnlyMemory<byte> buffer, long sum, int n) | |
{ | |
var span = buffer.Span; | |
fixed (byte* pStart = span) { | |
return ComputeSumSimd(new IntPtr(pStart), span.Length, sum, n); | |
} | |
} | |
private static unsafe (long, int) ComputeSumSimd( |
This file contains 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 static async Task<long> ComputeSumAsync(string fileName, | |
Func<ReadOnlyMemory<byte>, long, int, (long, int)> sumComputer, | |
CancellationToken ct = default) | |
{ | |
await using var fs = new FileStream(fileName, FileMode.Open); | |
var pipe = new Pipe(new PipeOptions( | |
minimumSegmentSize: MinBufferSize, | |
useSynchronizationContext: false)); | |
async Task ProduceAsync() { |
This file contains 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 static long ComputeSum(string fileName, | |
Func<ReadOnlyMemory<byte>, long, int, (long, int)> sumComputer) | |
{ | |
using var fs = new FileStream(fileName, FileMode.Open); | |
using var lease = MemoryPool<byte>.Shared.Rent(MinBufferSize); | |
var buffer = lease.Memory; | |
long sum = 0; | |
int n = 0; | |
while (true) { |
This file contains 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
auto computeSum(char* fileName) { | |
auto fIn = open(fileName, O_RDONLY | O_BINARY, 0644); | |
static constexpr size_t BUFFER_SIZE = 1 << 16; | |
uint8_t buffer[BUFFER_SIZE]; | |
uint8_t const* pBuffer = nullptr; | |
size_t bufferPos = 0; | |
size_t bufferLen = 0; | |
int64_t sum = 0; |
NewerOlder