Analyzing Performance (Documenting Progress, Results, etc.) #5150
Labels
Category: Doc
Requests, Issues and Changes targeting javadoc and module documentation
Category: Performance
Requests, Issues and Changes targeting performance
Revive: Keep
issue has been looked at and deemed potentially helpful for revive
Size: L
Very big effort likely requiring a lot of research and work in many areas across the codebase
Status: Needs Discussion
Requires help discussing a reported issue or provided PR
Status: Needs Investigation
Requires to be debugged or checked for feasibility, etc.
Topic: Architecture
Requests, Issues and Changes related to software architecture, programming patterns, etc.
Topic: Concurrency
Requests, issues, and changes relating to threading, concurrency, parallel execution, etc.
Topic: Stabilization
Requests, Issues and Changes related to improving stablity and reducing flakyness
Topic: WorldGen
Requests, Issues and Changes related to facets, rasterizers, etc.
Type: Question
Issue intended to help understanding something that is unclear
Milestone
Assumptions
Next Steps
Collected Insights
Past Insights
Related Issues
Concurrency Providers & Consumers
(current state as created by @skaldarnar for Reactor effort)
Time-consuming tasks
(as compiled by @DarkWeird):
Many time takes:
Many memory takes chunks... but we cannot shrink them almost. Bytewise operation take many time, any object structure (like octotree) take so huge memory.. that current impl is optimal. Java modules can enable agressive optimization if we hide it in separate module (or cannot). Also octotree can be more optimal by memory, when java implement compact class header. (Or we hide chunk in rust)
Most frequently called methods
(as compiled by @BenjaminAmos via JFR)
I don't know if this is right but a quick JFR recording seems to indicate
void org.terasology.core.world.generator.facetProviders.DensityNoiseProvider.process(GeneratingRegion, float)
as being called an awful lot (24% of the time). That doesn't necesarily mean that it's a bottleneck though (sampling does not measure execution time).Interestingly, on the slow server recording the most frequently sampled methods were:
com.google.common.collect.MapMakerInternalMap$HashIterator.nextInTable()
java.lang.invoke.VarHandleObjects$Array.getVolatile(VarHandleObjects$Array, Object, int)
The HashIterator method was generally (indirectly) called from:
void org.terasology.engine.rendering.logic.LightFadeSystem.update(float)
void org.terasology.engine.logic.behavior.BehaviorSystem.update(float)
void org.terasology.engine.logic.characters.CharacterSystem.update(float)
void org.terasology.engine.logic.common.lifespan.LifespanSystem.update(float)
void org.terasology.engine.logic.behavior.CollectiveBehaviorSystem.update(float)
Actually, it's those systems for both frequent methods.
Inside of those methods, the stack generally goes:
boolean com.google.common.collect.Iterators$ConcatenatedIterator.hasNext()
boolean java.util.Spliterators$1Adapter.hasNext()
boolean java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(Consumer)
Which implicates java.util.stream again (a known big issue in general).
DensityNoiseProvider is not as big of an issue on that machine though. It's only 1.52% of samples.
Could it possibly be related to
Terasology/engine/src/main/java/org/terasology/engine/entitySystem/entity/internal/PojoEntityManager.java
Lines 253 to 260 in f907533
Terasology/engine/src/main/java/org/terasology/engine/entitySystem/entity/internal/PojoEntityPool.java
Lines 287 to 300 in f907533
Multi-Threading
@BenjaminAmos found the following list of threads indicated by JFR (threads marked with '*' are assumed to be "ours"):
Code Areas with Longest Per-Call Durations
Based on the statistical info in https://benjaminamos.github.io/TerasologyPerformanceTracyView/tracy-profiler.html
TODO: Refactor the individual code areas to improve their performance and reduce their per-call run time.
LwjglGraphics.java:91
(4.4ms per call)WorldRendererImpl.java:343
(3.83ms per call)VoxelWorldSystem.java:91
(2.71ms per call)StateIngame.java:247
(2.14ms per call)LocalChunkProvider.java:179
(1.08ms per call)GameThreat.java:78
(0.85ms per call)TerasologyEngine.java:506
(0.76ms per call)TerasologyEngine.java:521
(0.60ms per call)LwjglGraphics.java:88
(0.54ms per call)ShadowMapNode.java:156
(0.46ms per call)References
Reactor Effort:
Potentially Helpful Tooling
F3
to open,F4
to cycle through individual tools)Monitoring
option inSettings->Autoconfig->System Settings
to show this information in a separate window (requires restarting the game). ThePerformance
tab will only function when the in-game performance monitor is open (F3
) andF4
has been pressed once.Information Sources
Performance-related issues:
Tooling-related issues:
Follow-Up Actions
The text was updated successfully, but these errors were encountered: