Skip to content

Commit

Permalink
perf: ⚡increase HEI recipe iteration by 1-3 seconds
Browse files Browse the repository at this point in the history
Since there istens of thouthands HEI recipes, rapid calling of progress bar steps caused excess second of waiting.

https://spark.lucko.me/MRBZYLxzrN?hl=340125
  • Loading branch information
Krutoy242 committed Jun 15, 2024
1 parent 85309bf commit dfb1811
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@@ -204,11 +204,11 @@ implements IRecipeRegistry {
private void addRecipes(List<Object> unsortedRecipes, ListMultiMap<String, Object> recipes) {
Set entries = recipes.entrySet();
int step = 0;
- ProgressManager.ProgressBar progressBar = ProgressManager.push((String)"Loading recipes", (int)(recipes.getTotalSize() + unsortedRecipes.size()));
+ ProgressManager.ProgressBar progressBar = ProgressManager.push((String)"Loading recipes", (int)((recipes.getTotalSize() + unsortedRecipes.size()) / 100));
for (Map.Entry entry : entries) {
String recipeCategoryUid = (String)entry.getKey();
for (Object recipe : (List)entry.getValue()) {
- if (step % 100 == 0) {
+ if (step % 100 == 99) {
progressBar.step("");
}
this.addRecipe(recipe, recipe.getClass(), recipeCategoryUid);
@@ -216,7 +216,7 @@ implements IRecipeRegistry {
}
}
for (Object recipe : unsortedRecipes) {
- if (step % 100 == 0) {
+ if (step % 100 == 99) {
progressBar.step("");
}
this.addRecipe(recipe, recipe.getClass(), null);

0 comments on commit dfb1811

Please sign in to comment.