In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
In general, there are three kinds of performance optimization in the project: resource optimization, rendering optimization, and model optimization. In resource optimization, we need to ensure that our resources are not repetitive or redundant, which requires careful import of resources given by others in the usual project. Rendering optimization means that when using some maps, techniques such as LOD can be used to reduce the number of model faces to increase the FPS frame rate. And use mask culling and other techniques. Model optimization is to minimize the number of faces and vertices, so that our CPU and GPU are no longer overloaded. Next, I will take you to take a look at some important parameters in our Profiler panel.
A. WaitForTargetFps:
Vsync (vertical synchronization) function, that is, displays the CPU wait time of the current frame
B. Overhead:
Profiler Total time-the sum of recording time for all individual items. It is used to record unclear time consumption to help further improve the statistics of Profiler.
C. Physics.Simulate:
The CPU elapsed time for the physical simulation of the current frame.
D. Camera.Render:
CPU usage of camera rendering preparation
E. RenderTexture.SetActive:
Set up the RenderTexture operation.
The underlying implementation: 1. Compare the ColorSurface and DepthSurface of the current frame with the previous frame.
two。 If the two Buffer are the same, no new RT is generated, otherwise, a new RT is generated, and the corresponding Viewport and spatial transformation matrix are set.
F. Monobehaviour.OnMouse_:
Used to detect mouse input message reception and feedback, including: SendMouseEvents and DoSendMouseEvents. (this will exist as long as the Edtor is on.)
G. HandleUtility.SetViewInfo:
Used only in Editor, the purpose is to make the display in GUI and Editor look consistent with the release version.
H. GUI.Repaint:
Redrawing of GUI (indicating that native OnGUI is used)
I. Event.Internal_MakeMasterEventCurrent:
Responsible for GUI messaging
J. Cleanup Unused Cached Data:
Clear out useless cached data, mainly including RenderBuffer garbage collection and TextRendering garbage collection.
1.RenderTexture.GarbageCollectTemporary: exists in the garbage collection of RenderBuffer, clearing temporary FreeTexture.
Garbage collection operation of 2.TextRendering.Cleanup:TextMesh
K. Application.Integrate Assets in Background:
Traverse the preloaded thread queue and finish loading, at the same time, complete the loading of texture, Update of Substance, etc.
L. Application.LoadLevelAsync Integrate:
The CPU used to load the scene is occupied. Usually, if this time is long, 70% of the time may be caused by too long Texture.
M. UnloadScene:
Uninstall GameObjects, Component, and GameManager in a scene, which is generally used when switching scenes.
N. CollectGameObjectObjects:
While executing the M item above, the GameObject and Component in the scene are aggregated into an Array. Then execute the following Destroy.
O. Destroy:
Delete CPU occupancy for GameObject and Component.
P. AssetBundle.LoadAsync Integrate:
Multithreading loads the contents of AwakeQueue, that is, multithreading executes the AwakeFromLoad function of the resource.
Q. Loading.AwakeFromLoad:
Called after the resource is loaded, each resource is processed with its application.
2. CPU Usage
A. Device.Present:
Device.PresentFrame time consuming shows that this option appears in the release version.
B. Graphics.PresentAndSync:
Display and vertical synchronization on GPU take time. This option appears in the release version.
C. Mesh.DrawVBO:
The rendering of Mesh's Vertex Buffer Object in GPU takes time.
D. Shader.Parse:
After the resource is added, the engine parses the Shader.
E. Shader.CreateGPUProgram:
Build the GPU project according to the graphics library supported by the current equipment.
3. Memory Profiler
A. Used Total:
The sum of Unity memory, Mono memory, GfxDriver memory and Profiler memory of the current frame.
B. Reserved Total:
The system applies for memory in the current frame.
C. Total System Memory Usage:
Virtual memory usage for the current frame. (usually 1.5 to 3 times the amount of memory we currently use)
D. GameObjects in Scene:
The number of GameObject in the current frame scene.
E. Total Objects in Scene:
The number of Object in the current frame scene (besides GameObject, there are Component, etc.).
F. Total Object Count:
Object data + number of Asset.
4. Detail Memory Profiler
A. Assets:
Texture2d: record the texture resources used in the memory of the current frame, including various GameObject textures, sky box textures and Lightmap resources used in the scene.
B. Scene Memory:
Record the memory footprint of all aspects of the current scene, including GameObject, resources used, various components, GameManager, etc. (days loaded through AssetBundle will not be shown here).
A. Other:
ManagedHeap.UseSize: the heap memory allocation caused by the code at run time, indicating the amount of heap memory allocated so far from the last GC.
SerializedFile (3):
WebStream: this is the memory footprint loaded by WWW.
System.ExecutableAndDlls: different platforms and different hardware will get different values.
5. Optimization focus
A. CPU-GC Allow:
Principle of concern: 1. Detect any one-time memory allocation greater than 2KB option 2. Check that each frame has the option of memory allocation above 20B.
B. Time ms:
Record the CPU usage per frame when the game is running (pay special attention to those above 5ms).
C. Memory Profiler-Other:
1.ManagedHeap.UsedSize: mobile games are recommended not to exceed 20MB.
2.SerializedFile: monitor whether it is unloaded by serializing files left when loading asynchronously (LoadFromCache, WWW, etc.).
3.WebStream: the decompressed version of resource files downloaded through asynchronous WWW in memory, which is several times or dozens of times larger than SerializedFile. *
D. Memory Profiler-Assets:
1.Texture2D: focus on checking whether there are duplicate resources and whether oversized Memory needs compression and so on.
2.AnimationClip: focus on checking whether there are duplicate resources.
3.Mesh: focus on checking whether there are duplicate resources.
6. Problems that may be encountered in the project
A. Device.Present:
1.GPU 's presentdevice is indeed very time-consuming, generally appearing in the use of very complex shader.
2.GPU runs very fast, but because of Vsync, it needs to wait a long time.
3. It is also the reason for Vsync, but other threads are very time-consuming, so the waiting time is very long, for example, this problem is easy to occur when excessive AssetBundle is loaded.
4.Shader.CreateGPUProgram:Shader in the runtime phase (non-preloaded) will appear stutter (Huawei K3V2 chip).
B. StackTraceUtility.PostprocessStacktrace () and StackTraceUtility.ExtractStackTrace ():
1. It is usually caused by Debug.Log or similar API.
two。 After the game is released, you need to block the Debug API.
C. Overhead:
1. Generally speaking, it is caused by Vsync.
two。 It usually appears on Android devices.
D. GC.Collect:
Reason: 1. Code allocation memory excess (malignant) 2. A certain time interval is called by the system (benign).
Occupied time: 1. Related to existing Garbage size 2. Related to the remaining memory usage particles (for example, when there are too many scene objects and low utilization, memory rearrangement needs to be done after GC is released)
E. GarbageCollectAssetsProfile:
1. The engine is performing a UnloadUnusedAssets operation (which is time-consuming and is recommended when cutting the scene).
two。 Avoid using Unity built-in GUI as much as possible to avoid GUI.Repaint transition to GC Allow.
3.if (other.tag = = GearParent.MogoPlayerTag) is changed to other.CompareTag (GearParent.MogoPlayerTag). Because other.tag is a GC Allow that produces 180B.
f. Use less foreach, because each foreach to generate an enumerator (about 16B memory allocation), try to change to for.
G. Lambda expression, improper use will result in memory leakage.
h. Minimize the use of LINQ:
1. Some features are not available on some platforms.
two。 A large amount of GC Allow will be allocated.
i. Number of times to control StartCoroutine:
1. Open a Coroutine and allocate at least 37 Bytes of memory.
An instance of 2.Coroutine class-21B.
3.Enumerator-16B.
j. Use StringBuilder instead of string direct concatenation.
k. Cache components:
1. Each GetComponent will be assigned a certain amount of GC Allow.
two。 Each Object.name allocates 39 Bytes of heap memory.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.