-
Notifications
You must be signed in to change notification settings - Fork 7
Refactor Everything #41
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
Conversation
Signed-off-by: unilock <unilock@fennet.rentals>
it's unused Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
NO CLASSLOADING ALLOWED!! Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
Also remove benchmarks that never appear in a production environment... Signed-off-by: unilock <unilock@fennet.rentals>
that's what it is, isn't it? Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
oops Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
Fixing the RandomSplitter should also fix this Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
|
Hi, thanks for the PR. Got a few things to note:
|
Minecraft could easily switch to LXM if they want, or completely overhaul their random system, so I would like to still be able to easily benchmark this. (Plus, these benchmarks are *tiny*, and only run in developer environments)
"TheFasterRandom" might sound cool at first, but it will probably get pretty old over time. Also, the logger message about Faster Random being present has been removed due to the main entrypoint also being removed. Not sure if it should stay or not. Aside from that, there isn't really anything I disagree with. I'll go test this out against BetterX when i have the time. |
|
BetterX (I tested BetterEnd) works without the workaround mixin with this PR, and feature generation (grass, trees, etc) is now 1:1, when it wasn't previously due to |
|
@AnOpenSauceDev That's really interesting! By the way, all PR branches I make are protected and can't be deleted after they're merged. Would you mind either changing protection rules to only protect the main branch, or deleting merged branches? |
I agree, but I still don't think embedding the benchmarks in the same jar used in production is a good idea - in case e.g. a developer is testing compatibility between their mod and Faster Random in their own dev environment. Maybe a testmod could be used instead? Fabric API uses quite a few of those: https://github.com/FabricMC/fabric/blob/fc5276a561510a620bb5793b63b77248a59d566d/build.gradle#L172-L215
I think it would probably be better to name it something like |
|
Test mod sounds like a good idea, could look into that!
Maybe in the future we'd want a config for users so keeping it the same name as currently is my vote, even if |
|
This wouldn't execute all at once. 99% of the time in Java, the CPU goes through a function linearly unless you directly create a new non-blocking thread. All this should do is generate a number, make the JVM discard the result, then generate the next number. The main thread is blocked by this, so the worker threads probably aren't doing much, let alone on the same core. If you're talking about individually timing each random function, that's also not necessary, as ideally you only want to keep one generator that's the best all-round so you don't have to waste time trying to make multiple generators work nicely together. |
|
ok |
|
Is this PR still being worked on? If not, I could try fixing parts of this up for a merge. |
That's a good point! I'll change the name back then.
Sorry, I recently got a new laptop, and haven't transferred everything over from the old one yet (including my dev environment). I'll rebase it on the current master branch soon. |
Signed-off-by: unilock <unilock@fennet.rentals>
# Conflicts: # gradle.properties # src/main/java/com/github/anopensaucedev/fasterrandom/FasterRandom.java # src/main/java/com/github/anopensaucedev/fasterrandom/FasterRandomPreLaunch.java # src/main/java/com/github/anopensaucedev/fasterrandom/mixin/RandomMixin.java
Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
Signed-off-by: unilock <unilock@fennet.rentals>
|
This branch is now up-to-date with upstream Faster Random 4.0.1. I've also moved the benchmarks to a testmod; they can be run with the |
|
Awesome. Could you check up my review comment? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, aside from my review question about the PreLaunch changes.
src/main/java/com/github/anopensaucedev/fasterrandom/FasterRandomPreLaunch.java
Outdated
Show resolved
Hide resolved
Signed-off-by: unilock <unilock@fennet.rentals>

This PR makes a number of opinionated changes:
RandomGenerators at the source, and throw aRuntimeExceptionif it can't find the one it needsRandomGeneratorRandomnow contains theRandomGeneratorFactoryin a static fieldRandomGeneratorRandom#splitwas made to be more like that of CheckedRandom(upstreamed)RandomGeneratorRandomnow implements its ownRandomSplitter(as a private static inner class) instead of usingCheckedRandom's, which fixes BetterEnd & BetterNether incompatibilities #34(upstreamed)ChunkRandomMixinhas been removed accordingly(upstreamed)RandomGeneratorRandom#nextLongnow usesnextLonginstead ofnextInt, oopsRandomMixin#fasterrandom$createLocalInjectnow usesThreadLocalRandomlike the originalRandomclass does