Jump to content

Which one eats less cpu %


Recommended Posts

Posted

Yo, yeah. i would like to use the singlefilter since it would make my code whole lotta cleaner but does it eat more cpu? im noob :d ty

RS2Widget w = widgets.singleFilter(widgets.getAll(), f -> f.isVisible() && f.getMessage().equals("ok") && f.getTextColor() == 138573512);
if (w != null)
	interact();

VS

RS2Widget w = widgets.getWidgetContainingText("ok");
if (w != null && w.isVisible() && w.getTextColor() == 15837581)
	interact();

 

Posted

I believe both would require roughly the same amount since I think they would both have to loop through all the active widgets to retrieve the correct one. Also once you have searched once for the widget you can than reuse that variable instead of searching for the widget again. That way you will only have to run that code once.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...