How Can Developers Identify CPU Bottlenecks in Unity Lua Code?
Lua is widely used by game development teams to implement hot updates, making Lua performance optimization an increasingly important concern. GOT Online previously supported Lua memory analysis and now adds Lua CPU cost analysis. Developers can use the new module to inspect high-cost Lua functions, examine call stacks at different levels, and investigate CPU time at specific frames.
Summary Lua is widely used to implement code hot updates in game projects, increasing the need for Lua performance analysis. GOT Online now supports both Lua memory analysis and Lua CPU cost analysis. The CPU Cost module lists the top 10 entry functions with the highest cumulative CPU time. Developers can inspect overall call stacks, call stacks for specific scenes, and call stacks for individual frames to investigate performance bottlenecks. The analysis reports Lua functions, but CPU time spent in C functions called by Lua is included in the reported costs. Why Is Lua CPU Performance Analysis Important for Unity Games? Lua has become a standard choice for implementing code hot updates across many game development teams. As a result, optimizing Lua performance has become an increasingly important requirement for development teams. GOT Online previously supported Lua memory analysis. It now extends this capability with Lua CPU cost analysis, allowing developers to investigate both Lua heap memory allocations and CPU time. The Lua Performance Analysis module is available in the demo on the GameOptim website. https://uwa overseas public.oss us east 1.aliyuncs.com/uploads/markdown/f3e025af 342a 46dd 9159 55625542241a.png How Can Developers Find Lua Functions with the Highest CPU Cost? In the latest Lua Performance Analysis interface, the CPU Cost module appears in the left sidebar. This module lists the top 10 entry functions with the highest cumulative CPU time, giving developers a starting point for identifying functions that account for substantial CPU costs. https://uwa overseas public.oss us east 1.aliyuncs.com/uploads/markdown/139db205 f685 48ad aa91 3abb9226aec1.png By starting with these high cost entry functions, developers can narrow down which functions to investigate further. How Can Developers Investigate Lua CPU Cost at Different Levels? Clicking an entry function opens its call stack information for further analysis. GOT Online provides three views: Overall call stack: Inspect the function's overall CPU cost call stack. Scene specific call stack: Examine the call stack for a specified scene. Frame specific call stack: Inspect the detailed CPU cost call stack for any individual frame. https://uwa overseas public.oss us east 1.aliyuncs.com/uploads/markdown/df1bf550 9435 4a3d 8d4d b27341b151e0.png These views help developers investigate high cost functions at different levels of detail and locate potential performance bottlenecks more efficiently. What Does GOT Online Include in Lua CPU Cost Analysis? GOT Online provides comprehensive CPU cost analysis and heap memory allocation analysis for Lua code. Combined with detailed call stack information, these capabilities help development teams identify performance bottlenecks and investigate opportunities to improve runtime efficiency. One important detail is how function costs are reported: the functions listed in this analysis are Lua functions, but the CPU time spent in C functions called by Lua is included in their reported costs. This distinction is important when interpreting the results and investigating the sources of CPU overhead. FAQ What does the Lua Performance Analysis module in GOT Online do? It supports Lua CPU cost analysis and Lua heap memory allocation analysis, helping developers investigate performance bottlenecks through detailed call stack information. How does GOT Online identify high cost Lua functions? The CPU Cost module lists the top 10 entry functions with the highest cumulative CPU time, allowing developers to identify functions for further investigation. Can developers inspect Lua CPU costs for a specific frame? Yes. Developers can inspect the overall call stack, the call stack for a specified scene, and the detailed call stack for any individual frame. Does Lua CPU cost analysis include time spent in C functions? Yes. The analysis lists Lua functions, but CPU time spent in C functions called by Lua is included in the reported costs. Where can developers access Lua Performance Analysis? The Lua Performance Analysis module can be viewed in the demo on the GameOptim website. New users can get 2 hours of free GOT Online testing time after completing registration. https://www.gameoptim.com/?fopt=blog About GameOptim GOT Online GOT Online is a cloud based performance analysis platform with online performance reports for deeper analysis and collaboration. Based on visualized data display, providing targeted analysis suggestions and performance parameter trends, facilitating efficient quality control execution. To meet a wide range of optimization needs, GOT Online provides four major analysis modes: • Overall Performance Analysis • Mono Heap Memory Analysis • Lua Performance Analysis • GPU Performance Analysis