Skip to content
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

Optimization solve the timings problem in TechGenerator and TechMutation #36

Closed
RelativoBR opened this issue Apr 6, 2023 · 11 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@RelativoBR
Copy link
Collaborator

User Report: Identified a high consumption of server resources by some addon machines, requested an optimization so that the machines can use less resources.

Info: TechGenerator 3.29% and TechMutation 3.09%

Images:

image

image

@RelativoBR RelativoBR added the bug Something isn't working label Apr 6, 2023
@RelativoBR RelativoBR self-assigned this Apr 6, 2023
@JustAHuman-xD
Copy link
Contributor

I'll take a look

@RelativoBR
Copy link
Collaborator Author

@JustAHuman-xD Could you check this PR? User who reported asked to include a limiter of 10 machines per chuck, I included this customization option, but with a default value of 100

#37

@SchnTgaiSpock
Copy link
Contributor

SchnTgaiSpock commented Apr 6, 2023

looks like TechGenerator/TechMutation.validRecipeItem might be an issue? it is iterating over all the recipes per tick, and the inputs probably wont be changing so often so saving the recipe in a cache might be a better option

@RelativoBR
Copy link
Collaborator Author

this makes sense

@JustAHuman-xD
Copy link
Contributor

Can you send the entire timings report
Also is this machine async or not?

@JustAHuman-xD
Copy link
Contributor

looks like TechGenerator/TechMutation.validRecipeItem might be an issue? it is iterating over all the recipes per tick, and the inputs probably wont be changing so often so saving the recipe in a cache might be a better option

I feel like this isn't the problem as every AContainer machine does this and they don't appear on timings this bad.

@RelativoBR
Copy link
Collaborator Author

@JustAHuman-xD
Copy link
Contributor

The main lag is coming from cloning the slimefun item stack

@JustAHuman-xD
Copy link
Contributor

ItemStack input1 = produce.getInput1().clone();

Is there any reason that you are calling .clone() for both of these here? I don't think its necessary and that is what is lagging it. I would try removing the clone call and doing some testing.

@JustAHuman-xD
Copy link
Contributor

Looks like you also do this in some other blocks, I would recommend removing it from them aswell.

@RelativoBR
Copy link
Collaborator Author

ok, i will adjust

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants