Jump to content

Performance


mehmet

Recommended Posts

Hi all,

I want to check my code for performance.
GetTickCount it shows cpu loading or code reading speed?

I do not understand what value is normal. How to understand that my code is good? by performance
For example, speedometer takes 2.50% cpu is this normal?

Link to post

@mehmet

 

tickCount shows execution timing.

local timeNow = getTickCount()

for i=1, 1000 do
	local newFunction = function () end
end

outputChatBox("It took: " .. (getTickCount() - timeNow) .. " ms, to execute this code.")

 

2.5% CPU is high, but not critical.

You should be more worried about resources that show ~10%+.
The gamemode `tactics` is a bad example of that.

 

 

Link to post

@IIYAMA

"You should be more worried about resources that show ~10%+."       -       Which show ~10% CPU? 
"The gamemode `tactics` is a bad example of that."        -       This is not understood. Please explain



 

Link to post
10 minutes ago, mehmet said:

@IIYAMA

"You should be more worried about resources that show ~10%+."       -       Which show ~10% CPU? 
"The gamemode `tactics` is a bad example of that."        -       This is not understood. Please explain



 

You can use 'ipb' resource in-game.

Type start ipb, then type ipb in console. It shows usage of CPU, for client/server.

In options you can type -d, by that you will know source (first line of function).

Link to post
5 minutes ago, majqq said:

You can use 'ipb' resource in-game.

Type start ipb, then type ipb in console. It shows usage of CPU, for client/server.

In options you can type -d, by that you will know source (first line of function).

Thanks, I know that. I just don't know what values are valid.

ipb shows execution timing?

Edited by mehmet
Link to post
1 hour ago, mehmet said:

@IIYAMA

"You should be more worried about resources that show ~10%+."       -       Which show ~10% CPU? 
"The gamemode `tactics` is a bad example of that."        -       This is not understood. Please explain



 

I am not a professional at hardware performance, so the information below might not be 100% correct.

You have per CPU core an amount of processing power available. If you have a duo core then your pc have 2 cores. And for a quad-core you have 4 of those. (virtual cores excluded)

Your system will assign application processes to those cores. (MTA is an application) MTA can only use one of those cores. So that is your limit. If you have a lot of cores it doesn't usually mean you have more performance in MTA. But it can it can relieve pressure by being able to keep other applications at different cores.

 

If my interpretation is correct, then 100% is the available amount of (1 CPU core) power assigned for your resources. This is most likely not 100% of this single CPU core.  yes I know, it is complicated stuff.

Crossing that value should result in high frame dropping.

Please correct me if I am wrong.

Edited by IIYAMA
  • Thanks 1
Link to post
7 hours ago, mehmet said:

just tell me which indicators you should rely on after writing the code. I need to understand the code is good or bad

Alright,

 

Go to this page:

https://wiki.multitheftauto.com/wiki/Resource:Performancebrowser

 

Next to high CPU usage, your code can also be creating a memory leak. This means that your code is not able to clean itself.

Just like buy stuff your entire life, but you never throw it away. At the end it gets piled in your basement...

https://wiki.multitheftauto.com/wiki/Resource:Performancebrowser#Category_-_Lua_memory

 

To check this:

-1. Go to this page:

https://wiki.multitheftauto.com/wiki/Resource:Performancebrowser#Category_-_Lua_memory

0. Start your resourcebrowser.

1. Set category: lua memory

2. Start all your resources you would normally need.

3. Wait a minute or two for the memory values to be normalised.

4. Make a screenshot of the values, this is your first sample.

5. repeat step 4 multiple, with a delay of your choice.

6. Now compare the samples.

The column current should always get down at a given point. If it keeps increasing forever, then you have a memory leak in your code.

Check also column timers, it is not recommended to have here a leak. This can/will crash your server after a while.

 

 

 

 

 

 

 

 

  • Thanks 1
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...