Archived Trait Optimization

This suggestion has been archived / closed and can no longer be voted on.
Status
Not open for further replies.
Joined
Dec 23, 2012
Messages
78
Reaction score
108
Points
0
Location
Sweden
I have been thinking that we could optimize the trait plugin to save performance. We may not get big diffrences. but atleast try to get rid of unneeded lag. My idea was that forexample the speed trait. It gives you speed effect around once a min. Couldnt it instead give you speed for unlimited time. So it just needs to give it once. And when u change the traits. it removes the speed effect from you. Which means it gives it once and thats it. I dont know if it will help but i dont see any bad things of testing.
What do everyone else think?
 
This suggestion has been closed. Votes are no longer accepted.
That actually makes a deal of sense. However, the cooldown on absorption2 ending, and re-newing the four hearts has saved a lot of people.

You're on two red hearts, you're about to die, and suddenly; 4 gold hearts appear and you're up to 6 hearts ~
That's an amazing luck/risk trait, and adding something like this would take that away.

Also, if it only gives you it once, and you drink milk, what would happen? Would it just quickly re-new the buffs?
 
That actually makes a deal of sense. However, the cooldown on absorption2 ending, and re-newing the four hearts has saved a lot of people.

You're on two red hearts, you're about to die, and suddenly; 4 gold hearts appear and you're up to 6 hearts ~
That's an amazing luck/risk trait, and adding something like this would take that away.

Also, if it only gives you it once, and you drink milk, what would happen? Would it just quickly re-new the buffs?
Well if it didn't you could /trait u speed2 twice to reset it.
 
... what makes you think the trait plugin creates any performance loss?
 
... what makes you think the trait plugin creates any performance loss?

Running all kinds of code takes time. So technically all plugins affect performance even if just the tiniest bit. I am not 100% sure how MassiveTraits is coded but I can guess.
Hooking into bukkit events.
Running schedulers.
Changing variables/objects, when players adds/removes traits.
EDIT: These examples is just some of the code. If anyone wants to know what I mean, feel free to ask.
 
Last edited:
Running all kinds of code takes time. So technically all plugins affect performance even if just the tiniest bit. I am not 100% sure how MassiveTraits is coded but I can guess.
Hooking into bukkit events.
Running schedulers.
Changing variables/objects, when players adds/removes traits.
EDIT: These examples is just some of the code. If anyone wants to know what I mean, feel free to ask.

Somewhere along the lines of reading my post, you should have realized the relativity of my statement compared to CPU hogs like MCMMO and AI, instead of making the assumption I don't know what I'm talking about.
 
Somewhere along the lines of reading my post, you should have realized the relativity of my statement compared to CPU hogs like MCMMO and AI, instead of making the assumption I don't know what I'm talking about.

I'm sure he was just using basic knowledge of the subject to make an educated guess on where it was coming on, I don't think in any way that he was picking holes in your post, it's just what he thought on the subject. I think we all know that both MCMMO and AI are both hogs on CPU, but these are just things that are generic things that can cause lag.
 
Somewhere along the lines of reading my post, you should have realized the relativity of my statement compared to CPU hogs like MCMMO and AI, instead of making the assumption I don't know what I'm talking about.
He was probably using layman terms to allow everyone else to understand what he was trying to say. No need to be so hostile :P
 
Yeah you have to realize that when things are executed thousands of times per minute such as how MCMMO fires on every event, those are the plugins that will be creating performance problems and those are the plugins that should be focused on, rather than a plugin like MassiveTraits that doesn't fire nearly as frequently.
 
Yeah you have to realize that when things are executed thousands of times per minute such as how MCMMO fires on every event, those are the plugins that will be creating performance problems and those are the plugins that should be focused on, rather than a plugin like MassiveTraits that doesn't fire nearly as frequently.
I'm assuming MassiveTraits executes almost as much as McMMO. The server has to apply extra hit damage, extra damage taken, reapply effect traits such as speed, etc. But McMMO is probably coded a lot less efficiently than MassiveTraits, I'm assuming.
 
I'm assuming MassiveTraits executes almost as much as McMMO. The server has to apply extra hit damage, extra damage taken, reapply effect traits such as speed, etc. But McMMO is probably coded a lot less efficiently than MassiveTraits, I'm assuming.

Extra Hit Damage is an event and extra damage taken are both events. So rather than:

"Check every 1/1000 of a second if damage is taken, then change the damage."

It's actually...

Check for bukkit "On Hit" event, then change the damage.

Since bukkit is going to be checking for the event whether the plugin is running or not, this will cause very minimal extra lag. Also an event such as setting the speed every minute would cause minimal lag too, because in "coding time", 1 minute is an extremely long period of time and is never going to cause a decrease in performace.

However, with MCMMO it needs to make internal calculations when it receives the event as-well and it needs to save those calculations to a database which is partly the reason it causes more lag.

In conculsion: This is a problem, yes, but such a miniscule one that nobody should be focussing their attention to it and in the grand scheme of things it makes no difference.
 
Somewhere along the lines of reading my post, you should have realized the relativity of my statement compared to CPU hogs like MCMMO and AI, instead of making the assumption I don't know what I'm talking about.
You asked a question and I answered it.
Because from a programmers view it makes sense to optimise even if just the tiniest bit.
When you didn't said you meant and I don't have access to any kind of timings on MassiveCraft. How should I be able to make any assumptions in what causes most performance issues?
 
Well, there are two commonly-used ways to repeat things in Bukkit.
One is, like you said, to repeat something after a certain period of time, usually measured in server ticks (which are 1/20 of a second, not 1 millisecond).
The other is to use what's called an "event handler." An event handler is what plugins use to alter how certain things work (e.g. placing blocks, chatting, attacking, even being kicked can be changed).
The first one is the primary lag-causer, especially when a ton of things are repeated over very short intervals.
 
Status
Not open for further replies.