Lua CPU in Rev:1.4/1.5

Following on from my last two posts: Profiling CC2 Lua and Revolution and Lua CPU usage I talked about measuring the performance of my “do radar sweep” code. Specifically this was my update_modded_radar_data() function.

After work today I found myself not totally satisfied with what I was telling everyone, that “rev 1.5 uses less CPU than 1.4” because I’d not actually timed 1.4 properly. Yes in the last blog post I did time the function above, but in a real game that only gets called once every 3-4 seconds, and is purposely spread around to avoid bursts of work.

So, I decided to do some more realistic timing and basically time the entire update() function in the vehicle control script by using the same method.

I used the same map as I did before, but automated the timing using both versions.

And here we go! the results are in and 1.5 is indeed significantly better than 1.4! I’m not sure how much of this is due to the increased use of local function aliases in my 1.5 code or eliminating the use of pcall() unless debug is enabled. Still, it is showing that we can do 17% more stuff in the same time in 1.5 than in 1.4. Or, put it another way, 1.5 uses only 83% of the CPU as 1.4 did.

By:

Posted in:


Leave a comment