Performance regression in the crafting menu
Describe the bug
The performance of opening, searching, or switching tabs within the crafting menu near large numbers of items has slowed significantly.
Attach save file
This is a debug-derived save which illustrates the problem, using a single tile full of sand.
Steps to reproduce
From the provided save
- Open the crafting menu.
- Tab between the crafting tabs.
- Note that it may take several seconds to load each.
From a new world
- Via the debug menu, set all skills to 10.
- Unlock all recipes in the debug menu.
- Spawn 4096 sand via the debug menu.
- Optionally, drop the sand. This might make the performance drop more noticeable, although I didn't time it.
- Remove the Debug Hammerspace mutation if your character has it.
- Open the crafting menu and tab between the tabs, noting that it may take several seconds to load each.
Expected behavior
Previously, the crafting menu loaded significantly faster. For example, on an admittedly heavily modded save (not provided), the loading time has gone from a second or two to half a minute or more.
Screenshots
No response
Versions and configuration
- OS: Linux
- OS Version:
- Game Version: 0.J [64-bit]
- Graphics Version: Tiles
- Game Language: System language []
- Mods loaded: [ Dark Days Ahead [dda] () ]
Although the above doesn't include it, likely due to an error on my part in how I'm building it, the save was generated with e8d93eaa0d7fd4a622209359a1c6ff59f5343b60, which exhibits the slowdown.
Additional context
I haven't bisected it, but 121ee8f6cb0e2cc410ca87ad4258678c757f0b41, from about a week ago, doesn't have this performance issue, while e8d93eaa0d7fd4a622209359a1c6ff59f5343b60 does.
My own attempts at profiling have shown that a lot of time is spent in provider_quality_level, and I suspect this regression may have been introduced in #88292, although I don't know enough about the code in question to speculate on how to improve it:
Please let me know if you need any further information.
Source: CleverRaven/Cataclysm-DDA