Difference between revisions of "CPU-usage of Functions"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Haama
(Useful contribution info)
imported>Qazaaq
m (Reverted edits by Anubis4545 (Talk); changed back to last version by Haama)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This is a list of functions and how much they drop FPS. It's (well, will be) organized from the most CPU-intense functions to the least.
This is a list of functions and how much they drop FPS. It's (well, will be) organized from the most CPU-intense functions to the least.


If you would like to contribute, create 2 new items. One will keep track of your FPS, the other will test the function. On the first item add this script:
If you would like to contribute, see [[Testing Script CPU Usage]] for more details, or download the [http://www.tesnexus.com/downloads/file.php?id=13343 Speed Test Template] mod.
<pre>scn aaaFPSTrackerScript


short Counter
Finally, post your results here! Please post the average of the tests, sign your tests, and give a brief description of your computer's hardware on your User page. (an example is coming up, as soon as I can figure out tables)
float Timer
 
begin GameMode
  if (Counter <= 100)
    set Counter to (Counter + 1)
    set Timer to (Timer + GetSecondsPassed)
  else
    set Timer to (100 / Timer)
    message "FPS was %.2f", Timer
    RemoveMe
  endif
end</pre>
and this script to the test item:
<pre>scn aaaTestItemScript
 
begin GameMode
  ;Tested function
end</pre>
Save and activate the mod. In game, add the items to the player by opening the console (default ~), and typing in ''player.AddItem YourItem n'' and pressing <Enter>, where YourItem is the EditorID of your item, and n is the number of items to add.
 
Find a quiet spot in game to test: No NPCs roaming around, no sparkling Ayleid wells nearby, etc. Start the debug mode by opening the console, and typing in ''TDT''. The number in the upper-right is your FPS. Try to find a place to look where your FPS is stable. Looking straight up into the sky seems to be the best, but make sure you aren't hitting the max FPS (60). Keep an eye on it in case it suddenly drops, but you'll be using the tracker item for a more precise calculation.
 
Start out by finding the base (or control) FPS. Add only the tracker item (and only one) and write down the FPS. Then add both the tracker and a single test item (don't leave the console in-between adding the two) and write down the message. Continue alternating between the two tests, and mix up how many test items you add.
 
Finally, post them here! Please post the tests, and the average of the tests. Also, please sign your tests, and give a brief description of your computer's hardware on your User page. (I'll work on an example soon)




Line 36: Line 10:


GetNumItems - This function takes longer depending on the number of items in the container. Takes less time then GetInventoryObject for the same number of items.--[[User:Haama|Haama]] 19:04, 11 September 2007 (EDT)
GetNumItems - This function takes longer depending on the number of items in the container. Takes less time then GetInventoryObject for the same number of items.--[[User:Haama|Haama]] 19:04, 11 September 2007 (EDT)
[[Category:Code Optimization]]

Latest revision as of 11:14, 18 March 2008

This is a list of functions and how much they drop FPS. It's (well, will be) organized from the most CPU-intense functions to the least.

If you would like to contribute, see Testing Script CPU Usage for more details, or download the Speed Test Template mod.

Finally, post your results here! Please post the average of the tests, sign your tests, and give a brief description of your computer's hardware on your User page. (an example is coming up, as soon as I can figure out tables)


Heavy functions[edit | edit source]

GetFPS - Once per frame, lost ~3 FPS --Haama 19:04, 11 September 2007 (EDT)

GetNumItems - This function takes longer depending on the number of items in the container. Takes less time then GetInventoryObject for the same number of items.--Haama 19:04, 11 September 2007 (EDT)