Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Optimization] Use LXM random generator #50

Merged
merged 5 commits into from
May 4, 2024

Conversation

HaHaWTH
Copy link
Member

@HaHaWTH HaHaWTH commented May 2, 2024

This PR adds L64X128MixRandom(LXM) random generator to the RandomSource, which is much faster.

Some JREs does not support LXM generators and will cause a crash, maybe we can handle this more gracefully?

In my tests, Azul zulu JDK doesn't support this, but GraalVM works fine.

@HaHaWTH HaHaWTH assigned HaHaWTH and Dreeam-qwq and unassigned HaHaWTH May 2, 2024
@Dreeam-qwq
Copy link
Member

Crash when using GraalVM 21 from its website

[20:07:24 INFO]: [STDERR]: java.lang.ExceptionInInitializerError
[20:07:24 INFO]: [STDERR]:      at net.minecraft.util.RandomSource.create(RandomSource.java:31)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.util.RandomSource.create(RandomSource.java:16)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.world.level.levelgen.WorldOptions.randomSeed(WorldOptions.java:132)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.dedicated.DedicatedServerProperties.<init>(DedicatedServerProperties.java:172)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.dedicated.DedicatedServerProperties.fromFile(DedicatedServerProperties.java:207)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.dedicated.DedicatedServerSettings.<init>(DedicatedServerSettings.java:19)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.Main.main(Main.java:135)
[20:07:24 INFO]: [STDERR]:      at org.bukkit.craftbukkit.Main.main(Main.java:356)
[20:07:24 INFO]: [STDERR]:      at io.papermc.paperclip.Paperclip.lambda$main$0(Paperclip.java:42)
[20:07:24 INFO]: [STDERR]:      at java.base/java.lang.Thread.run(Thread.java:1583)
[20:07:24 INFO]: [STDERR]: Caused by: java.lang.IllegalArgumentException: No implementation of the random number generator algorithm "L64X128MixRandom" is available
[20:07:24 INFO]: [STDERR]:      at java.base/java.util.random.RandomGeneratorFactory.findProvider(RandomGeneratorFactory.java:229)
[20:07:24 INFO]: [STDERR]:      at java.base/java.util.random.RandomGeneratorFactory.factoryOf(RandomGeneratorFactory.java:275)
[20:07:24 INFO]: [STDERR]:      at java.base/java.util.random.RandomGeneratorFactory.of(RandomGeneratorFactory.java:360)
[20:07:24 INFO]: [STDERR]:      at org.dreeam.leaf.util.math.random.TheFasterRandom.<clinit>(TheFasterRandom.java:17)
[20:07:24 INFO]: [STDERR]:      ... 10 more

@HaHaWTH
Copy link
Member Author

HaHaWTH commented May 3, 2024

Crash when using GraalVM 21 from its website

[20:07:24 INFO]: [STDERR]: java.lang.ExceptionInInitializerError
[20:07:24 INFO]: [STDERR]:      at net.minecraft.util.RandomSource.create(RandomSource.java:31)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.util.RandomSource.create(RandomSource.java:16)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.world.level.levelgen.WorldOptions.randomSeed(WorldOptions.java:132)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.dedicated.DedicatedServerProperties.<init>(DedicatedServerProperties.java:172)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.dedicated.DedicatedServerProperties.fromFile(DedicatedServerProperties.java:207)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.dedicated.DedicatedServerSettings.<init>(DedicatedServerSettings.java:19)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.Main.main(Main.java:135)
[20:07:24 INFO]: [STDERR]:      at org.bukkit.craftbukkit.Main.main(Main.java:356)
[20:07:24 INFO]: [STDERR]:      at io.papermc.paperclip.Paperclip.lambda$main$0(Paperclip.java:42)
[20:07:24 INFO]: [STDERR]:      at java.base/java.lang.Thread.run(Thread.java:1583)
[20:07:24 INFO]: [STDERR]: Caused by: java.lang.IllegalArgumentException: No implementation of the random number generator algorithm "L64X128MixRandom" is available
[20:07:24 INFO]: [STDERR]:      at java.base/java.util.random.RandomGeneratorFactory.findProvider(RandomGeneratorFactory.java:229)
[20:07:24 INFO]: [STDERR]:      at java.base/java.util.random.RandomGeneratorFactory.factoryOf(RandomGeneratorFactory.java:275)
[20:07:24 INFO]: [STDERR]:      at java.base/java.util.random.RandomGeneratorFactory.of(RandomGeneratorFactory.java:360)
[20:07:24 INFO]: [STDERR]:      at org.dreeam.leaf.util.math.random.TheFasterRandom.<clinit>(TheFasterRandom.java:17)
[20:07:24 INFO]: [STDERR]:      ... 10 more

1 min, wait for me to fix this:(

@HaHaWTH HaHaWTH marked this pull request as draft May 3, 2024 01:04
@ConquerEarth

This comment was marked as duplicate.

@Dreeam-qwq
Copy link
Member

Related

Crash when using GraalVM 21 from its website

[20:07:24 INFO]: [STDERR]: java.lang.ExceptionInInitializerError
[20:07:24 INFO]: [STDERR]:      at net.minecraft.util.RandomSource.create(RandomSource.java:31)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.util.RandomSource.create(RandomSource.java:16)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.world.level.levelgen.WorldOptions.randomSeed(WorldOptions.java:132)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.dedicated.DedicatedServerProperties.<init>(DedicatedServerProperties.java:172)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.dedicated.DedicatedServerProperties.fromFile(DedicatedServerProperties.java:207)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.dedicated.DedicatedServerSettings.<init>(DedicatedServerSettings.java:19)
[20:07:24 INFO]: [STDERR]:      at net.minecraft.server.Main.main(Main.java:135)
[20:07:24 INFO]: [STDERR]:      at org.bukkit.craftbukkit.Main.main(Main.java:356)
[20:07:24 INFO]: [STDERR]:      at io.papermc.paperclip.Paperclip.lambda$main$0(Paperclip.java:42)
[20:07:24 INFO]: [STDERR]:      at java.base/java.lang.Thread.run(Thread.java:1583)
[20:07:24 INFO]: [STDERR]: Caused by: java.lang.IllegalArgumentException: No implementation of the random number generator algorithm "L64X128MixRandom" is available
[20:07:24 INFO]: [STDERR]:      at java.base/java.util.random.RandomGeneratorFactory.findProvider(RandomGeneratorFactory.java:229)
[20:07:24 INFO]: [STDERR]:      at java.base/java.util.random.RandomGeneratorFactory.factoryOf(RandomGeneratorFactory.java:275)
[20:07:24 INFO]: [STDERR]:      at java.base/java.util.random.RandomGeneratorFactory.of(RandomGeneratorFactory.java:360)
[20:07:24 INFO]: [STDERR]:      at org.dreeam.leaf.util.math.random.TheFasterRandom.<clinit>(TheFasterRandom.java:17)
[20:07:24 INFO]: [STDERR]:      ... 10 more

1 min, wait for me to fix this:(

It relates to PaperMC/Paperclip#66 and PaperMC/Paper#10114, needs use Leaf own modified Paperclip to fix it.

@HaHaWTH HaHaWTH marked this pull request as ready for review May 4, 2024 17:42
@Dreeam-qwq Dreeam-qwq merged commit 234d7e3 into Winds-Studio:ver/1.20.6 May 4, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants