-
Notifications
You must be signed in to change notification settings - Fork 1
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
World exploration lag #9
Comments
Could you please share your tracing data, screenshots of stacks, etc? |
Off the cuff, a few notes:
I will take a look at using ore dict for stone to see if that helps. |
I've seen a hashcode() lag pattern during profiling but it was negligible until I've realized it was showing up in the logs during lag spike events: https://gist.github.com/LemADEC/5a1d26de7a52fabe8104e6370904a7c9 I did a code review that showed inefficient hashCode() evaluation: public int hashCode()
{
return this.properties.hashCode();
} which is from com.google.common.collect.ImmutableMap<K, V> public int hashCode() {
return Sets.hashCodeImpl(entrySet());
} (nota: entrySet() return value is cached) which is from com.google.common.collect.Sets static int hashCodeImpl(Set<?> s) {
int hashCode = 0;
for (Object o : s) {
hashCode += o != null ? o.hashCode() : 0;
hashCode = ~~hashCode;
// Needed to deal with unusual integer overflow in GWT.
}
return hashCode;
} which is a loop on all properties to call IProperty.hashCode() and do some maths. IProperty.hashCode() is overridden in the case of Enum, Boolean and Integers, so almost everytime. We're trying to grab a more focused profiling to confirm. |
I was proposing |
Alright, this is helpful. Let me do some digging and figure out a better way to translate a block state into a unique identifier. |
So, I added some timing info and did some of my own testing:
I think it's right, but would appreciate your help in validating that it doesn't break anything. Is there anyway I could give you a pre-build and have you re-profile with your setup? |
just post an alpha version on curseforge, and we'll try it out. |
Here's the current patch: https://gist.github.com/dizzyd/f02cd3f1103adcfd024f0c47a0f16ccd I'll let you know once it's approved by CF. |
Alpha available here: https://minecraft.curseforge.com/projects/prospects/files/2601810 |
@LemADEC how did it work? |
Sorry, still working on that test. |
Tested in single player: the updated version feels faster but the profiler is still unhappy. Apparently, I've missed a GC lag caused by creating BlockPos for every blocks in the chunk, here:
Consider using a MutableBlockPos allocated once before the x,y,z loops, updated with setPos(). Also, I suspect lag spikes during save in
Here's our current world for reference, that file seems pretty complex for something saved with the world: ProspectWorldData.zip |
I've got a similar problem, but probably a different cause: Prospects is creating massive amounts of cascading chunk loads with OreSpawn installed. OreSpawn and Quark both cause a small amount of cascading chunk loads, but as seen in this log excerpt the vast majority of cascaded chunk loads are tagged as belonging to Prospects. |
As of prospects-1.0.5.jar, TPS lag spike are observed when players are exploring new chunks.
Our map is pregenerated so it's not world generation lag.
According to our profiling, it's related to the chunk scanning doing lookup with a slow hash computation, here:
prospects/src/main/java/com/dizzyd/prospects/world/OreDictCache.java
Line 79 in 5d6b06b
We do have the UndergroundBiomes mod which replaces vanilla stone with various alternative ones, hence the existing 'fast path' isn't used.
From a quick code review:
or simply add support for ore dict stones (adding all blocks from ore:stoneAll to the fast path?).
The text was updated successfully, but these errors were encountered: