EssentialsX

EssentialsX

2M Downloads

Should I submit a pull request for this?

Samistine opened this issue ยท 3 comments

commented

I notived that we are storing values from the underlying memoryconfiguration in local variables. I don't believe this is necessary. Please let me know if changing this to access the configuration directly instead of thru extra variables would be accepted in a pull request.

https://github.com/drtshock/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/UserData.java

My assumption is memoryconfiguration is fast enough that it doesn't require caching.

commented

It wouldn't be. A map lookup is much slower than field access.

commented

How much faster? Also wouldn't it be more efficient to only save the configuration when explicitly told to, I see a lot of places where set methods are being sequentially called and it causes it to save multiple times instead of just when it needs to(at the end).

commented

Field access is one operation, config access is several far more intensive ones (hash the key, look up bucket for key, look up value for key).

Furthermore, moving stuff into maps/configs defeats the entire point of object-oriented programming.

Also wouldn't it be more efficient to only save the configuration when explicitly told to

Yes, optimizing I/O is a much better use of time than slowing down field access ;)