Optimize cold start speed and block loading speed

This commit is contained in:
BruceChen 2022-08-25 01:34:07 +08:00
parent 01ef9a89ca
commit 58eafdfd5c
8 changed files with 147 additions and 127 deletions

View file

@ -20,11 +20,6 @@ namespace MinecraftClient.Mapping
/// </summary>
private readonly Chunk[] chunks;
/// <summary>
/// Lock for thread safety
/// </summary>
private readonly ReaderWriterLockSlim chunkLock = new ReaderWriterLockSlim();
/// <summary>
/// Create a new ChunkColumn
/// </summary>
@ -44,27 +39,11 @@ namespace MinecraftClient.Mapping
{
get
{
chunkLock.EnterReadLock();
try
{
return chunks[chunkY];
}
finally
{
chunkLock.ExitReadLock();
}
return chunks[chunkY];
}
set
{
chunkLock.EnterWriteLock();
try
{
chunks[chunkY] = value;
}
finally
{
chunkLock.ExitWriteLock();
}
chunks[chunkY] = value;
}
}