Reduce stuttering with fast world gen

This commit is contained in:
James Seibel
2025-06-14 16:17:28 -05:00
parent 91743bf742
commit 9be56607a5
2 changed files with 21 additions and 5 deletions
@@ -69,7 +69,7 @@ public class DhDataOutputStream extends DataOutputStream
arrayCache.reset();
// Note: if the LZMA2Options are changed the array cache may need to be re-tested.
// the array cache was specifically tested and tuned for LZMA preset 3/4
return new XZOutputStream(stream, new LZMA2Options(3),
return new XZOutputStream(stream, new LZMA2Options(3),
XZ.CHECK_CRC64, arrayCache);
default:
@@ -63,8 +63,16 @@ public class LzmaArrayCache extends ArrayCache
{
return new byte[size];
}
// the array needs to be cleared to prevent accidentally sending dirty data
Arrays.fill(array, (byte)0);
// the array only sometimes needs to be cleared,
// clearing all the time results in unnecessary slowdowns
if (fillWithZeros)
{
// TODO it appears that this can prevent the CPU from working on
// other tasks, thus causing render thread lag even when run on a separate thread
Arrays.fill(array, (byte) 0);
}
return array;
}
@@ -107,8 +115,16 @@ public class LzmaArrayCache extends ArrayCache
{
return new int[size];
}
// the array needs to be cleared to prevent accidentally sending dirty data
Arrays.fill(array, (byte)0);
// the array only sometimes needs to be cleared,
// clearing all the time results in unnecessary slowdowns
if (fillWithZeros)
{
// TODO it appears that this can prevent the CPU from working on
// other tasks, thus causing render thread lag even when run on a separate thread
Arrays.fill(array, (byte) 0);
}
return array;
}