9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-archived-patches/unapplied/server/paper-patches/features/0020-Faster-random-generator.patch
Dreeam 236010caba Cooking Tutorial
1. Wet the drys
2. Dry the wets
3. Wet the drys
4. Dry the wets
5. Wet the drys
6. Now dust the wets
2025-03-28 03:11:27 -04:00

29 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
Date: Tue, 9 Nov 2077 00:00:00 +0800
Subject: [PATCH] Faster random generator
This patch replaces LegacyRandomSource with FasterRandomSource by default,
which is faster in general.
Benchmark results (10,000,000 iterations) (Azul Zulu 23.0.1)
FasterRandomSource (Leaf) (Backed by Xoroshiro128PlusPlus): 51,633,700 ns
LegacyRandomSource (Vanilla): 254,857,500 ns
ThreadUnsafeRandom (Moonrise): 102,265,100 ns
SimpleThreadUnsafeRandom (Moonrise): 97,054,600 ns
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index c60c05b9e426f56ed3e812abb9aae9ef52bd20e8..268fd8e60630e835c750a8b67201cc63f0b5193d 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -97,7 +97,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
}
private static WorldgenRandom getSeededRandom() {
- return new WorldgenRandom(new LegacyRandomSource(0));
+ return new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0) : new LegacyRandomSource(0)); // Leaf - Faster random generator
}
@Override