-
Notifications
You must be signed in to change notification settings - Fork 129
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
Class search adds significant startup delay #730
Comments
I don't really understand what you're trying to say. |
Yes, I do. You should pass the exact package locations, considering those will be finite from 1 to 3 at worst instead of spending 10 seconds (!) searching through dozens of packages with every class search in total just on startup So I would propose doing the following:
Class<?> findClass(String name, String... packages) {
for (String package : packages) {
// try catch around here
return Class.forName(package + "." + name);
}
// another try catch for the old Spigot package
return Class.forName("net.minecraft.server." + name);
// error here
}
|
Eh, yeah. Just realized I was looking at the wrong thing. That said, you need to check your attitude. Even though you are correct that the code needs to be reworked, your approach was hostile and my first reaction was to want you to go away. |
That is very true, sorry for that; I wanted to make it sound more jesting (or emphasizing) than hostile (https://m.youtube.com/watch?v=YqnS3LKsafY), though I failed. Hopefully you can get that sorted anyways :) |
Class search through https://github.com/libraryaddict/LibsDisguises/blob/master/plugin/src/main/java/me/libraryaddict/disguise/utilities/reflection/ClassMappings.java adds a significant amount of time to startup due to scanning a large number of packages instead of storing the actual package location in DisguiseType/passing it in the method calls. For versions that have Spigot's old everything package, you should instead check in that one package, and otherwise use the pre-defined one(s if there is multiple across versions).
Combined and just on startup, this method adds anywhere from 3 to 15 seconds of class search depending on the setup, then more still during uptime.
The text was updated successfully, but these errors were encountered: