Difference between revisions of "CPU-usage of Functions"
imported>Haama (Ok, that should make things "easier") |
imported>Haama (Well blast, that didn't work) |
||
Line 29: | Line 29: | ||
Start out by finding the base (or control) FPS. Add only the tracker item through the console ('''player.AddItem YourTrackerItem 1''') 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), write down the message, and remove the test items ('''player.RemoveItem YourTestItem #'''). Continue alternating between the two tests, and mix up how many test items you add. | Start out by finding the base (or control) FPS. Add only the tracker item through the console ('''player.AddItem YourTrackerItem 1''') 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), write down the message, and remove the test items ('''player.RemoveItem YourTestItem #'''). Continue alternating between the two tests, and mix up how many test items you add. | ||
Here's an easier way to do the tests above. Note that it will automatically alternate tests for you, and you can set NumTestItems to however many you would like to test through the console ('''set YourQuest.NumTestItems to #''' | Here's an easier way to do the tests above. Note that it will automatically alternate tests for you, and you can set NumTestItems to however many you would like to test through the console ('''set YourQuest.NumTestItems to #'''). Add this script to a quest, and start it through the console ('''StartQuest YourQuest'''). | ||
<pre>scn aaaTesterScript | <pre>scn aaaTesterScript | ||
short NumTestItems | short NumTestItems | ||
short Testing | short Testing | ||
Line 40: | Line 39: | ||
begin GameMode | begin GameMode | ||
set fQuestDelayTime to .01 ;so you don't have to wait | set fQuestDelayTime to .01 ;so you don't have to wait | ||
set ItemCount to (player.GetItemCount | set ItemCount to (player.GetItemCount YourTestItem) | ||
if ItemCount | if ItemCount | ||
player.RemoveItem | player.RemoveItem YourTestItem ItemCount | ||
endif | endif | ||
if (Testing == 0) ;Control tests | if (Testing == 0) ;Control tests | ||
Line 49: | Line 48: | ||
else | else | ||
player.AddItem YourTrackerItem 1 | player.AddItem YourTrackerItem 1 | ||
player.AddItem | player.AddItem YourTestItem NumTestItems | ||
set Testing to 0 | set Testing to 0 | ||
endif | endif |
Revision as of 16:23, 13 September 2007
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:
scn aaaFPSTrackerScript short Counter 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
and this script to the test item:
scn aaaTestItemScript begin GameMode ;Tested function end
Write down the FormIDs of the items. Save and activate the mod. In game, add the items to the player by opening the console (default ~), and typing in player.AddItem YourItem # and pressing <Enter>, where YourItem is the FormID of your item, and # 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 through the console (player.AddItem YourTrackerItem 1) 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), write down the message, and remove the test items (player.RemoveItem YourTestItem #). Continue alternating between the two tests, and mix up how many test items you add.
Here's an easier way to do the tests above. Note that it will automatically alternate tests for you, and you can set NumTestItems to however many you would like to test through the console (set YourQuest.NumTestItems to #). Add this script to a quest, and start it through the console (StartQuest YourQuest).
scn aaaTesterScript short NumTestItems short Testing short ItemCount float fQuestDelayTime begin GameMode set fQuestDelayTime to .01 ;so you don't have to wait set ItemCount to (player.GetItemCount YourTestItem) if ItemCount player.RemoveItem YourTestItem ItemCount endif if (Testing == 0) ;Control tests player.AddItem YourTrackerItem 1 set Testing to 1 else player.AddItem YourTrackerItem 1 player.AddItem YourTestItem NumTestItems set Testing to 0 endif StopQuest YourQuest end
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)
Heavy functions
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)