Is there a way to find out which part of a source code takes the most amount of CPU space or is there a way to see whats the most CPU-hungry? I know that sounds vague but i dont have a better way to word it.
If you want to see what proc/verb is taking up the most resources, profile the server! You can do this by opening the options and messages window on your game(you can do this by right-clicking the world icon in your game's window and selecting "Options & Messages" from the dropdown menu.
From here, go to the "Server" menu and then go to "Profile..." This will bring up the profile menu. You can select the Profile Code" tab or the "Profile Network" tab. Network logs the network usage by each client. You want to use the Code tab. The 'Profile Code' tab will display all the procedures that have been called, how many times each one has been called, CPU usage with each call and the time it's taken to complete. Mind you that using sleep() will cause the completion time for a procedure to be longer! Hope I helped! |
In response to Snyperwolf
|
|
Sort of, but not exactly. You can't shut down any of the processes, for example, but you can view them and see information about them and such.
|
Thanks for all your help i found out the problem. Mob/human/player/npc/proc/npcregenerator calls 1254 times before the character is even loaded.
While this is still open. i have 1 more issue i can run the game once a day. what i mean is i can host it once then if i close it and reopen the second time nothing opens only the boarders. any idea where to look into that issue? |
I'd make that another topic, if I were you. It sounds pretty different to this one. Cheers!
|
Never use infinite loops if it is physically possible to avoid them - always have some sort of limiter on them so they can't spiral.
Loading big images/sounds takes lots of resources - Use smaller files and file-types.
Avoid unnecessary repetition - Don't call a proc super often just to make sure it gets called when you need it - Find out exactly where it needs to be called, and call it there.
Mostly common sense. Even as much as cutting your code down into a more efficient system will take less resources, so do things in the shortest way you can.