9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-28 19:49:06 +00:00

smooth into the warm-up generator

This commit is contained in:
CocoTheOwner
2023-07-10 23:00:28 +02:00
parent a9ab3bc519
commit b64c821ef4

View File

@@ -111,7 +111,12 @@ public class IrisPregenerator {
}
private long computeETA() {
return (long) ((totalChunks.get() - generated.get()) / chunksPerSecond.getAverage()) * 1000;
return (long) ((generated.get() > totalChunks.get() >> 3) ? // Generated chunks exceed 1/8th of total?
// If yes, use smooth function (which gets more accurate over time since its less sensitive to outliers)
((totalChunks.get() - generated.get()) * ((double) (M.ms() - startTime.get()) / (double) generated.get())) :
// If no, use quick function (which is less accurate over time but responds better to the initial delay)
((totalChunks.get() - generated.get()) / chunksPerSecond.getAverage()) * 1000 //
);
}
public void close() {