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
Excessive CPU usage #77
Comments
I'm fairly certain this lag is being caused by using Permission.addParent in PermMan.construct. I'm not sure why this is being done, but it certainly shouldn't be. Every time you run addParent, it recalculates the permissions on every player that has that permission. Since this is done up to four times per permission check, that gets expensive really quickly, especially when there is a large number of players on the server. The addParent method should generally only be used when the plugin is loading, to set up the parent/child relationships for the permissions your plugin uses. It definitely shouldn't be run every time you check for permissions. In fact, you don't really need to use Permission objects at all, you should just be using strings. |
Argh! I did not realize that it was such a costly process! Makes me feel a bit silly honestly.. Anyway, I should have resolved the issue. Now I just need confirmation. |
What CB is NoItem-b237 built against? I'm using Spigot-b375 http://ci.md-5.net/job/Spigot/375/ 01:49:46 [INFO] [NoItem] Enabling NoItem v3.0.3-SNAPSHOT-237 |
Fix NPE on startup fixes problem that arose after fixing issue #77
Should be fixed now. Was just a simple ordering problem |
I am doing a series of test using the NoLag Examiner and am posting my results here.
The first test i did is breaking items. This was me running around punching grass blocks and longgrass and flowers for 30 seconds in a test server.
Here are the details:
Total duration: 5500.267 ms / 600 ticks
Average duration: 9.167 ms/tick
Selected event: PlayerInteractEvent[NORMAL]
Plugin: NoItem
Location: class net.worldoftomorrow.noitem.events.Listeners
So this would correspond to:
https://github.com/World-of-Tomorrow/NoItem/blob/master/src/main/java/net/worldoftomorrow/noitem/events/Listeners.java#L40
And subsequently to:
https://github.com/World-of-Tomorrow/NoItem/blob/master/src/main/java/net/worldoftomorrow/noitem/events/Handlers.java#L122
The next test i did was holding items. I filled my hotbar with items and quickly scrolled through it for 30 seconds.
Here are the details:
Total duration: 4379.407 ms / 600 ticks
Average duration: 7.299 ms/tick
Selected event: PlayerItemHeldEvent[NORMAL]
Plugin: NoItem
Location: class net.worldoftomorrow.noitem.events.Listeners
This corresponds to:
https://github.com/World-of-Tomorrow/NoItem/blob/master/src/main/java/net/worldoftomorrow/noitem/events/Listeners.java#L34
And subsequently to:
https://github.com/World-of-Tomorrow/NoItem/blob/master/src/main/java/net/worldoftomorrow/noitem/events/Handlers.java#L98
I might run additional tests, but i get the feeling that these results are not highlighting the specific issues... But I hope this information helps narrow down the root causes.
The text was updated successfully, but these errors were encountered: