bogstandard / rl-weather

Weather plugin for RuneLite
BSD 2-Clause "Simplified" License
9 stars 3 forks source link

Optimize CPU usage in overlay class and fix 0 div issue #2

Closed Cyborger1 closed 2 years ago

Cyborger1 commented 3 years ago

In the first commit, I removed the need to use a BufferedImage to draw the on screen graphics. You can use the object given as an argument to the render() method. This was most likely the culprit for the large CPU usage this plugin caused.

I also changed the way drops are cleared from the LinkedList, using removeIf instead. It's a little better, but this could probably be optimized further. However, the amount of drops in the list at any given time is small enough that this is unlikely to be of any major concern.

Second commit fixes #1 by adding an if check for div > 0 before attempting to add the dither.

bogstandard commented 2 years ago

Huge thanks for doing this mate, sorry for being so slow responding (life eh!). Merged and very much appreciated.

bogstandard commented 2 years ago

FYI; I've made a pull request on the Plugin Hub to get this updated. Again, apologies for sitting on this for so long.

https://github.com/runelite/plugin-hub/pull/2009