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

Too many sorts on Opening Grid #3573

Closed
BONNe opened this issue Oct 5, 2023 · 1 comment
Closed

Too many sorts on Opening Grid #3573

BONNe opened this issue Oct 5, 2023 · 1 comment
Labels
bug Something isn't working performance Performance issue

Comments

@BONNe
Copy link

BONNe commented Oct 5, 2023

Describe the bug

I have created an addon for mod that adds extra sorting properties for some objects. But when it is used on a huge amount of objects, it starts to take a very noticeable time to open the grid.

For investigation purpose, I added a code call that triggers when elements are sorted, and I found out that opening a Grid triggers 8 sorting calls.

The first two calls are triggered on initialization with an empty object map, and it does not matter.
Then it creates a new list from all object map and sorts the list, as expected.

The weird part happens after that. The sorting is triggered 5 more times after that, and every time it creates a new item list with all objects from the map, and sorts everything again.

The code part where I added a breakpoint is:
https://github.com/refinedmods/refinedstorage/blob/develop/src/main/java/com/refinedmods/refinedstorage/screen/grid/view/GridViewImpl.java#L67-L70

I do not how huge an issue it is, but I think that triggering the sort 5 times when opening a grid on items that are already sorted is a bit weird.

How can we reproduce this bug or crash?

  1. Add a break-point in https://github.com/refinedmods/refinedstorage/blob/develop/src/main/java/com/refinedmods/refinedstorage/screen/grid/view/GridViewImpl.java#L67-L70
  2. Open a grid
  3. Notice that the code is triggered 8 times.

What Minecraft version is this happening on?

Minecraft 1.20.1

What Forge version is this happening on?

47.1.0

What Refined Storage version is this happening on?

v1.12.3

Relevant log output

No response

@BONNe BONNe added the bug Something isn't working label Oct 5, 2023
@raoulvdberge raoulvdberge added the performance Performance issue label Nov 4, 2023
@raoulvdberge
Copy link
Collaborator

Hi, thanks for the investigation. I have been looking into this for Refined Storage 2, which is where it will be fixed.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working performance Performance issue
Projects
None yet
Development

No branches or pull requests

2 participants