I have the following `Update()` code which calculate the approximate amount of loop per second. // Update is called once per frame [MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] void Update() { long loopCount = 0; long maxLoopCount = 500000000; // five hundred million double startingTime = Time.realtimeSinceStartupAsDouble; while(true) { loopCount++; if(loopCount >= maxLoopCount) { break; } } double endTime = Time.realtimeSinceStartupAsDouble; double elapsedTime = (endTime - startingTime); Debug.Log("elapsed time: " + elapsedTime); Debug.Log("loop count: " + loopCount); Debug.Log("approximate loop per second: " + (loopCount*(1/elapsedTime))); } Notice that i used NoOptimization and NoInlining attribute, which means the loop is not optimized away by the compiler. I checked the debug log and below are the longest elapsed time logged in the console (the slowest loop performance). elapsed time: 0.249041300000044 loop count: 500000000 approximate loop per second: 2007699124.60267 It can do 500 million loop in just a quarter of a second, which means it can do approximately 2 billion loop per second. I have a second code which also calculate the approximate amount of loop per second, but i used `Time.realtimeSinceStartupAsDouble` in the loop. // Update is called once per frame [MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] void Update() { long loopCount = 0; double startingTime = Time.realtimeSinceStartupAsDouble; double endTime = startingTime + 1; while (true) { loopCount++; if (Time.realtimeSinceStartupAsDouble >= endTime) { break; } } double elapsedTime = (endTime - startingTime); Debug.Log("elapsed time: " + elapsedTime); Debug.Log("loop count: " + loopCount); Debug.Log("approximate loop per second: " + (loopCount * (1 / elapsedTime))); } I checked the debug log and below are the slowest loop logged in the console. elapsed time: 1 loop count: 27078590 approximate loop per second: 27078590 It can only do 27 million loop per second, in contrast to 2 billion loop per second from earlier. The previous code is approximately 74x faster than the code with `Time.realtimeSinceStartupAsDouble`. After finding this, i do another test with `Time.realtimeSinceStartup` instead of the double version. // Update is called once per frame [MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] void Update() { long loopCount = 0; float startingTime = Time.realtimeSinceStartup; float endTime = startingTime + 1; while (true) { loopCount++; if (Time.realtimeSinceStartup >= endTime) { break; } } float elapsedTime = (endTime - startingTime); Debug.Log("elapsed time: " + elapsedTime); Debug.Log("loop count: " + loopCount); Debug.Log("approximate loop per second: " + (loopCount * (1 / elapsedTime))); } I checked the debug log and below are the slowest loop logged in the console. elapsed time: 1 loop count: 24932097 approximate loop per second: 2.49321E+07 It can only do 24 million loop per second, similar to the `Time.realtimeSinceStartupAsDouble` version. Does anyone know why it is so slow? Now i'm hesitant to use it inside a loop because it can make the loop significantly slower. What are the alternative to these two that i can use to do timing inside a loop? My specification: Unity version: 2022.3.14f1 Scripting Backend: Mono .NET version : .NET framework Managed Code Stripping: Disabled CPU: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80 Ghz OS: Windows 10 Home Single Language