-
Notifications
You must be signed in to change notification settings - Fork 51
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
Clearing chunk cache takes ages #246
Comments
I experienced this behavior for a much longer time. But only for Debug builds! The mentioned commit only removes Ubuntu 16.04 support from the build chain. (No code change.) |
I did some digging around and finally found out the culprit is not Minutor itself, but the QtCreator's debugger. When running under the debugger, the I even made a simple test project to measure the
I assume the biggest difference between For comparison, the very same executable, when run under QtCreator's debugger, produces these results:
Here if we compare the I think this issue can be closed, with "won't fix, have workaround". |
Is that still the case under Qt6? |
In case of Palette entries, we know that Mojang will always use english names. Therefore these strings can always be represented with 7bit ASCII (or UTF-8 to have some margin). So we definitely do not need UTF-16 support there. I will think about it during August . . . |
I haven't tested this with anything other than Qt 5.15.1 on Windows. I expect it to be Windows-specific and QtCreator-specific (rather than Qt-specific). My thinking was that Minutor could instead use a global palette (number -> complete block identification) and have each chunk section provide a number -> number map into it. Then we could even use Here's the test project, feel free to experiment with it and let me know if you find anything interesting: |
? We are exactly doing that already ? There is ONE global definition with all Blocks having a number (hash of ID name). |
I don't think that's what Minutor does, at least in the 1.13+ branch of the loading code. The section's local palette seems to stay allocated until the entire |
Maybe we mean the same, but use different words? Per Section the Palette with string IDs is loaded and converted into a HID (hashed ID). These HIDs are later used to get Block information from the global BlockIdentifier. That is what I mean with "number -> BlockInfo" Probably the string representation of the Palette stays (unused) in memory and some more ugly stuff. When we need BlockInfo for rendering, we access it by numbers. |
Here are my results (I put both values of a test into one line for better comparison):
I do not have relevant difference if I start the executable from a console window or from QtCreator. AMD Ryzen 5 3600, Windows 10, QtCreator 4.12.3, Qt 5.12.10, MSVC 2019 |
Access times too quick to accurately measure? |
Yes, the values are different each run. But not that bad to draw a general conclusion. Before changing our data types I would do more benchmarking. std::map is claimed to be O( log(N) ) Therefore the unordered_map should always be faster when the map is large enough. |
I think another point to consider is character encoding - |
I'm already convinced to change data types that hold NBT data to |
As of commit 4ff2053, clearing the chunk cache (i. e. refreshing or reloading the map) takes an awful lot of time - long minutes (!) even in a Release build. It seems that most of the time is spent deleting the per-section palettes, mostly the
properties
member.Tested on a self-compiled Win64 binary built with Qt 5.15.1.
The text was updated successfully, but these errors were encountered: