Script Optimisation

Post » Fri Jan 22, 2010 4:33 am

I've created a plugin that uses NVSE's http://fose.silverlock.org/fose_command_doc.html#Label, http://fose.silverlock.org/fose_command_doc.html#Goto, and http://fose.silverlock.org/fose_command_doc.html#PrintToConsole functions, along with the http://geck.gamesas.com/index.php/SetConsoleOuputFunction (missing "t" in "output" intentional) to compare how efficient different segments of code that essentially have the same purpose are. It's not available yet, but once I've polished it up a bit and written some instructions I'll upload it to the nexus.

If you're interested, I started a similar thread to this one back when I was still involved in the Fallout 3 modding community. I have it backed up in its current state in case it gets wiped, but currently you can still find it http://www.gamesas.com/index.php?/topic/987561-script-optimisation/.

Each test consists of four parts, each lasting for 50 frames:
  • A buffer
  • The first segment of code
  • Another buffer
  • The second segment of code

After the test is completed, the average framerate for each stage is printed to the console, and the test is repeated. Each test is repeated 5 times, then the number if times the code being tested is run per frame is increased by 500 and a notification sound is played. This continues until one of the tests has an average framerate that drops below a minimum framerate specified before the tests started, at which point another notification sound is played and the console is opened automatically.

Each test was run in a controlled environment (TestJoshWeapons, entered via http://geck.gamesas.com/index.php/CenterOnCell via the console straight from the main menu, i.e. before a game is started or loaded), the vanity camera has been disabled, no controls are touched and the camera is left in 1st person view. I tried to have as few programs running in the background as possible.



Here is a list of the tests I've performed so far, along with their results:

Testing the efficiency of using "if x/else" against using "if x == 0". I expect "if x/else" to be more efficient than "if x == 0", as it was in Fallout 3.
Spoiler

Actual code segments tested:
if player.GetDead == 0 ; Code1	set bTemp to player.GetScaleendif; vsif player.GetDead ; Code2else	set bTemp to player.GetScaleendif

Raw data obtained (frames per second):
Spoiler
IterationsPerFrame	Buffer1	Code1	Buffer2	Code20	35.536594	36.153286	36.845978	36.3108180	36.310818	36.818851	35.919537	36.5497060	36.049023	36.845985	36.416603	36.5764430	36.576447	36.845985	35.790974	36.9822500	35.790981	36.416599	36.845982	36.818848500	36.845982	36.416603	36.845985	36.310818500	36.845978	36.845982	36.549706	35.919537500	37.257816	36.310818	36.310825	36.416599500	36.710716	36.416603	36.845985	35.893753500	37.285599	36.416607	36.310818	36.5764391000	36.818851	36.416603	36.845978	37.2856031000	35.765381	36.310810	36.576435	36.3108221000	35.893753	36.845978	36.576443	36.8188511000	35.919537	36.818848	36.845978	36.5764431000	36.576443	36.576443	36.818848	36.3108221500	36.310810	36.576447	36.845982	36.4166031500	36.443138	36.416607	36.845985	36.8459741500	36.845974	36.416607	36.845982	36.8188441500	36.737686	36.153290	36.710712	36.4431381500	36.818840	36.845982	36.310818	36.1532902000	36.845982	36.845982	36.845978	36.5497092000	36.576447	36.416599	36.845982	37.2578242000	36.576443	36.576443	36.576447	36.4166032000	36.845982	36.845985	36.284470	36.1794472000	36.818844	36.845982	36.845985	36.1532862500	37.285599	36.982246	36.416603	36.8459822500	36.845982	36.845982	36.549706	36.4431422500	36.818848	36.845982	36.845982	36.4166072500	36.049023	36.845978	36.818844	36.5764392500	36.576443	36.153290	35.790977	36.8459783000	36.049023	36.818855	36.845978	35.8937533000	36.845978	36.737686	36.549706	36.5764433000	36.416603	36.576447	36.576443	36.5764393000	36.845985	36.416603	36.818844	36.5764473000	36.845985	36.416603	37.425144	36.1532863500	36.845985	36.576439	36.310822	36.1532903500	36.576443	36.845982	36.284462	35.9195373500	37.257824	36.153282	36.845978	37.2578163500	36.845982	36.845982	36.845985	36.4166033500	36.576443	36.818855	36.845982	36.4166034000	36.576435	36.153286	37.285610	36.4165994000	37.707386	36.153286	37.009624	36.1532864000	36.845982	36.818851	36.576447	36.4166034000	37.009613	36.153290	36.576443	36.4166074000	36.982250	36.310818	36.845982	36.8459824500	36.818855	36.443138	36.549706	36.8459854500	36.845985	36.416607	36.469730	36.4166034500	36.845982	36.818851	36.049019	36.8459784500	37.257820	36.179443	37.257820	36.0230454500	36.710709	36.416607	36.576447	36.8459745000	36.576439	36.416607	37.257820	36.4165995000	36.845978	36.982246	36.845985	36.4165995000	37.285610	36.416603	36.982246	36.4431505000	36.549706	36.443138	37.257824	36.4166075000	37.147099	36.416603	36.845985	36.4166075500	36.469730	36.416603	36.845978	36.4166075500	36.982250	36.416603	36.310814	36.4166035500	37.285610	36.416603	37.707390	36.0230455500	37.147102	35.997120	37.009617	36.4165955500	37.257824	36.416607	36.845985	36.4166036000	37.285606	36.416607	37.257820	36.4431386000	37.257816	36.416599	37.009617	36.4166036000	37.257816	36.023052	36.982250	36.4165996000	37.009624	36.416599	36.845982	36.4166076000	37.707390	36.416603	37.257824	36.0230526500	36.982243	36.443146	36.710712	36.0230566500	36.982246	36.023052	37.257820	36.4166076500	37.707390	36.023048	37.425144	35.9971246500	37.009617	36.416599	36.576443	36.4166036500	36.710712	36.416603	37.009621	36.4166077000	36.576443	36.416603	37.257824	36.0230527000	37.425137	36.023045	36.982246	36.4166037000	37.285603	36.416603	36.845978	35.3606727000	37.707390	36.416603	37.257820	36.0230457000	36.982246	35.612534	36.982246	36.0230457500	37.425148	36.023048	36.982243	35.2112667500	37.878788	36.416607	37.009617	35.2112587500	38.314175	36.023056	37.147099	35.2112587500	37.878780	36.416595	36.982250	35.2360737500	37.850109	34.458996	37.285603	35.9971168000	37.009624	35.612537	36.310818	35.3606768000	37.850109	36.416607	36.737686	33.7381908000	38.197094	36.153278	36.982246	33.7381908000	38.491138	36.416595	37.285599	34.8189358000	38.343563	35.211273	37.707390	33.7381868500	39.246464	35.236076	37.850109	32.3834198500	38.491138	35.612534	37.850117	33.0469258500	38.639874	34.482750	37.850109	33.4001278500	38.461536	35.612534	37.593983	31.4267698500	38.789757	34.083168	38.314175	32.3834159000	38.491142	33.046925	37.850109	30.8261369000	38.461533	34.482754	37.878788	31.7460319000	38.491142	34.083160	38.022812	29.9580549000	38.971157	34.083164	38.491142	30.8261349000	38.461529	34.843208	38.022812	30.8261349500	38.022804	33.046925	38.491142	29.6735889500	38.491142	32.051277	38.759689	30.2480309500	38.491142	33.377834	38.022808	30.2480289500	38.461540	33.400127	38.940804	30.2480289500	38.167938	33.046925	38.491146	31.11387110000	38.789757	30.229740	38.491142	28.36074610000	38.197098	31.426771	38.491138	28.36074310000	38.491146	31.113873	38.491138	28.86835710000	38.491146	32.051277	38.314175	29.67358810000	38.491142	31.725882	38.491146	28.62048510500	38.197094	30.525026	38.639874	27.63957810500	38.167934	30.826136	39.246468	27.63957610500	38.461540	29.691206	38.461533	28.12147910500	38.022808	30.248028	39.246464	27.39725310500	38.940800	30.248028	38.639877	27.39725311000	38.022816	30.525024	38.491150	25.83978711000	38.491146	28.121479	38.491150	25.43234411000	38.491150	29.137526	38.022812	26.27429811000	38.759689	30.248028	39.246460	26.27429811000	38.491150	29.673588	38.940804	26.06881311500	38.461540	29.411760	38.940811	25.44528611500	38.491142	27.870672	38.022812	25.64102011500	38.461540	27.870676	38.491142	25.64101811500	38.022808	28.885033	38.022816	24.91280011500	37.735840	28.376837	38.940807	25.23977112000	38.491138	28.105673	38.491146	24.85089112000	38.461540	27.639574	38.491146	23.91199712000	38.197094	27.397255	38.940804	24.28362512000	38.022812	26.709394	38.491146	25.23976712000	38.022816	28.105671	38.491146	24.09639012500	38.491146	27.159147	38.491146	23.74168612500	38.789753	26.274298	38.461533	24.10799612500	38.461540	27.173906	38.167938	24.65482512500	38.491142	26.709396	38.789757	23.39728512500	38.022812	26.709398	38.197098	23.74168213000	38.789757	26.483046	38.789757	23.22340613000	37.907509	25.037550	38.491142	22.41146913000	38.197094	25.839788	38.491142	22.57335713000	38.491138	25.432344	38.197090	23.05209413000	38.197094	25.641022	38.491138	22.41147213500	38.491138	24.850885	38.461536	22.73760413500	38.022816	23.912001	38.051750	23.05209413500	38.491142	24.654831	38.022816	22.10433013500	38.197094	24.850885	38.022808	21.94907413500	38.022808	25.050089	38.022812	21.27659214000	38.022808	24.850891	38.022808	22.25188614000	38.491138	22.893770	37.735847	21.36751714000	38.197098	23.741682	38.022816	21.51462914000	38.491142	24.096384	38.491138	20.94679314000	38.491150	24.461830	38.022812	21.80549014500	38.022816	23.741682	38.022808	21.23141914500	38.022808	23.397280	38.940807	20.41649414500	38.197098	23.223406	38.491138	21.22240614500	37.735844	22.893768	38.789757	20.94679514500	38.314171	23.741686	38.022812	21.23141915000	38.491142	22.563175	38.343555	18.96093915000	37.735847	23.397282	37.735840	20.67824615000	38.051746	23.223402	38.491150	20.15316215000	38.491150	21.654396	38.022808	20.67824615000	38.022808	22.573362	38.491142	20.41649415500	38.022812	22.104326	38.022812	19.78630615500	38.022816	22.573359	38.491142	19.30501715500	38.022808	22.573359	38.491138	19.78630415500	38.022808	21.949074	37.735844	20.16128715500	37.735840	21.654394	38.051746	18.85369316000	38.022808	21.505373	38.051746	18.10282716000	37.593987	21.367516	38.491150	18.41620416000	38.022808	21.231419	38.789757	18.96093816000	37.593979	22.411470	38.022812	18.42299316000	38.314175	21.654390	38.022808	18.42299316500	37.313427	21.222406	37.735844	17.80626916500	38.022816	21.367519	37.735847	17.80627116500	38.051754	20.678246	38.022808	18.20830016500	37.593979	19.661818	38.491142	18.00504116500	38.022812	20.161287	38.491138	17.41553517000	38.314171	19.912384	38.314171	17.51313417000	37.735847	19.546518	38.022812	17.74307817000	38.022812	20.678246	38.022816	17.90831017000	37.593979	20.807322	38.022812	17.90831017000	38.022812	20.416494	38.491142	18.00504117500	37.285599	19.912382	38.314175	17.70538117500	37.593987	18.740629	38.051743	16.86909717500	37.565739	19.661816	38.051746	17.51313417500	38.022804	19.538883	38.051750	17.51313417500	38.314175	20.283972	37.593983	17.61183518000	38.022816	18.635855	38.461533	17.42160218000	38.022816	18.315016	38.491146	17.32501618000	37.565731	18.747656	38.022812	17.04739218000	37.593983	19.538881	38.491138	17.42160018000	38.022808	18.315016	37.593979	16.35055518500	38.022812	18.315016	38.022808	16.27074618500	37.593979	18.416208	38.022812	16.52346218500	37.593983	18.416206	38.022808	16.96065118500	37.147099	18.315018	38.022816	16.78415518500	37.565739	17.908310	37.565735	17.14089819000	38.022808	18.214933	38.167934	15.94896119000	37.850109	18.109383	38.314178	16.10824619000	38.314175	17.235435	38.022808	16.27074419000	38.022812	17.901897	37.878788	16.18646619000	37.313427	17.901897	38.491142	16.10824619500	38.314167	17.901896	37.764347	15.47987719500	37.593979	18.109379	37.735844	15.86797719500	37.735851	18.005041	38.022812	16.10824819500	38.022808	17.513134	38.197098	16.02563919500	37.593979	17.901896	38.022812	15.56177920000	37.565735	16.436556	37.593979	15.86797720000	37.850113	17.611834	37.593979	15.78781120000	37.735844	17.325018	37.593979	16.10305820000	37.593983	17.325016	37.565735	15.71338720000	37.285606	17.611834	37.735847	15.79279820500	37.565735	17.235437	38.022812	15.63477020500	37.850109	17.235435	38.022816	15.26251420500	37.313427	16.688917	37.593987	14.83679420500	37.593979	17.229496	37.593979	15.63477020500	37.565735	17.421604	37.878780	15.55693721000	37.593979	16.436554	38.022808	15.11944221000	37.565739	16.960649	37.565742	15.07386121000	38.051754	16.778522	37.593979	15.33271921000	37.147099	17.361111	38.022812	15.48467021000	37.565739	17.140896	37.735847	14.63700021500	37.147102	16.025642	38.022804	14.77104821500	37.285606	16.270746	37.735847	15.11944221500	37.593983	16.103060	37.764351	14.83679421500	37.147102	16.270744	37.565735	15.11944321500	37.425152	16.270744	37.565739	14.77104722000	37.593987	16.186466	37.593979	14.43417822000	37.593983	15.787813	37.735847	14.56876322000	36.873154	15.484670	37.593983	14.56876322000	37.565742	16.270744	37.593979	14.50115922000	37.735840	15.867978	38.022816	14.43834622500	38.022816	15.787811	36.337200	14.20858022500	37.565742	16.025640	38.022816	14.14026922500	37.593979	15.943877	37.147099	14.59427622500	37.147099	15.787811	37.565739	14.31024522500	37.593983	15.188334	37.313431	14.56876323000	37.147099	15.634770	38.314178	13.99384023000	37.313435	15.408319	37.878784	13.87347123000	36.603218	15.465510	38.022812	14.18037223000	37.593987	15.262515	37.593979	13.87347123000	37.425148	15.484669	37.565739	13.99775823500	37.565739	15.051173	37.425148	13.39763923500	37.147099	14.306150	38.022812	13.35469823500	37.147095	15.413068	37.565739	13.63884123500	37.313427	15.114873	37.313431	13.87347123500	37.593979	15.046643	37.878784	13.71741924000	37.147099	15.484669	37.565739	13.46619624000	37.878780	15.119443	37.147099	13.57957324000	37.147099	15.188334	38.051750	12.88991524000	37.147095	15.046643	37.878784	13.46619724000	37.147099	15.262514	37.593983	13.57957424500	37.147099	15.262514	37.593983	13.29787024500	37.147099	14.836794	37.593983	13.15789224500	37.147099	14.907572	37.735851	13.04801424500	37.147099	15.046642	37.593987	13.29786924500	37.147099	14.530658	37.285610	12.61988525000	37.147099	14.501159	37.593979	13.02761625000	36.873154	14.836794	38.051750	12.92323225000	37.147099	14.568762	37.735844	13.02761625000	37.147099	14.771048	37.593983	12.94330525000	36.873150	14.522218	37.147099	13.08215325500	37.593983	14.306150	37.593979	12.63583225500	37.593979	13.520820	37.593979	12.87332325500	37.850109	14.310245	37.147099	12.87000925500	37.593987	14.144269	37.850109	12.71940625500	37.147102	14.330752	37.565735	12.79099226000	36.873158	14.180372	37.593979	12.44090326000	37.147099	14.120302	37.565739	12.49063026000	36.737690	14.371943	37.285606	12.09482026000	37.147095	14.245012	37.593979	12.53761026000	37.593987	14.056787	38.022808	12.61988526500	37.147099	14.180372	37.147099	12.44090326500	37.147102	14.056787	37.147099	12.47193526500	37.425144	13.873471	37.425144	12.23391026500	37.593983	13.993840	37.147099	12.32741326500	37.147095	13.354698	37.593990	12.29407127000	37.147099	13.579574	37.313427	12.00479827000	36.982239	13.679888	37.147099	12.14181227000	37.147099	13.694876	38.022808	12.23391027000	36.873154	13.524477	37.593979	12.09482027000	36.710716	13.935338	37.147099	12.00479927500	37.425144	12.870009	37.147095	11.82871727500	36.710709	13.579574	37.147099	11.88777527500	37.147099	13.065062	37.147099	11.91610727500	37.147102	13.354697	37.285606	11.87084127500	36.469723	13.376134	37.850117	12.05109328000	37.147099	13.241523	37.593979	11.82591928000	36.737686	13.068477	37.147099	11.32502628000	37.425148	13.154430	37.593979	11.65500928000	37.147102	13.245029	37.565742	11.74259928000	36.710716	13.245030	37.147095	11.69590528500	37.593987	13.082152	37.425152	11.48633028500	37.147099	12.926574	37.565739	11.46262928500	37.397152	13.082152	37.593983	11.09139328500	36.873158	12.889916	37.453182	11.50218328500	36.310818	13.319123	37.147099	11.61170329000	37.147099	12.870010	36.873154	11.32759229000	36.443146	12.873322	37.147099	11.29943429000	37.425148	12.667846	37.147099	11.32502729000	37.425140	12.787722	37.593987	10.93852429000	37.147099	12.840264	36.873150	11.33786729500	36.710716	12.588114	37.147102	11.24606229500	36.737690	12.667845	37.285603	11.06684229500	37.425152	12.667845	37.147099	11.10617329500	37.147099	12.616701	37.147102	11.09139329500	36.982246	12.360938	37.425148	10.97694830000	36.710720	12.248894	36.710712	11.01564230000	36.710720	12.471935	37.147099	10.87665730000	36.710709	12.471934	37.147099	10.93852430000	36.737690	12.437808	37.147095	11.01321430000	37.147102	12.667845	36.737694	10.95050230500	37.147099	11.655009	37.593983	10.86484130500	37.147099	12.186202	37.147099	10.80613730500	36.710712	12.204048	37.147099	10.97694830500	36.443150	12.376235	37.147099	10.84128330500	36.737690	12.327413	37.147099	10.87665731000	36.710716	12.186203	37.147099	10.57753231000	36.737686	11.739841	36.873158	10.72041131000	36.710720	12.138866	37.147099	10.75731631000	36.710716	12.186202	37.147099	10.79214331000	36.443146	12.159531	37.147099	10.71811431500	37.147095	11.839921	36.737686	10.48437831500	37.009621	11.901925	37.147099	9.99600231500	36.310814	11.958858	36.873150	10.55520231500	36.737690	12.001917	37.147095	10.61345831500	36.576439	11.916107	36.710716	10.51967032000	36.737686	11.671332	36.873150	10.43841332000	35.790974	11.671332	37.425144	10.44059232000	37.147102	11.284133	37.147102	10.44059432000	36.049023	11.726076	37.147099	10.37344532000	36.710716	11.828717	36.710712	10.45369132500	36.469727	11.655009	37.119526	10.18745032500	36.310818	11.739841	36.710712	10.25430632500	36.710712	11.528705	37.147102	9.78282032500	36.710720	11.698640	36.710720	10.20824932500	36.179447	11.698641	37.147099	10.21868033000	36.284470	11.381741	36.737690	10.12145633000	36.310814	11.379150	37.147099	10.07861233000	36.710720	11.366218	36.443146	10.15640833000	36.284466	10.952901	36.737686	10.20616533000	36.737686	11.340438	37.147099	10.08064433500	36.710709	11.205735	36.469730	9.93246033500	37.009617	11.325026	36.710720	9.90295033500	36.310822	11.286679	36.443150	9.99400333500	36.310818	11.218307	37.147095	9.59692933500	36.710720	11.246062	37.313427	9.964128
Here's a plot - http://i.imgur.com/E2CYs.png

The results show that it's more efficient to use "if x/else" than it is to use "if x == 0". No effect on framerate was noticed until about 9,000 iterations per frame.


(Requested by Tarrant, assuming I understood correctly at 2:30 am)
Testing the performance of http://geck.gamesas.com/index.php/GetItemCount (and presumably other functions that use form lists) when using form lists of different sizes. I expect it to be more efficient to check the smaller form list.
Spoiler

Two form lists were used - "CCCTestFormList", containing 7 identical armour items of which the player had 3, and "CCCTestFormListHalf", containing only the 3 items in the player's inventory. Actual code tested:
set iTemp to player.GetItemCount CCCTestFormListHalf ; Code 1; vsset iTemp to player.GetItemCount CCCTestFormList ; Code 2

Raw data obtained (frames per second):
Spoiler
IterationsPerFrame	Buffer1	Code1	Buffer2	Code20	36.576443	36.576443	36.845982	36.8188510	36.845982	36.153290	36.576443	36.8459850	36.710724	36.179447	36.549706	36.3108220	36.845982	36.576439	37.257820	36.1532860	36.576443	36.845978	36.845978	36.818855500	36.179451	36.549706	36.737686	36.845985500	36.818848	36.443142	36.982250	36.153286500	36.049026	36.982250	36.576439	36.310818500	36.576447	36.416599	36.310814	36.818848500	36.469730	36.416599	35.790977	36.8459821000	36.549706	36.845985	36.153290	37.2856061000	36.845978	36.818855	36.576443	36.1532861000	36.049019	36.576447	37.257824	36.8459851000	36.845985	36.845978	36.310822	36.1532941000	37.257813	36.845985	36.576439	36.4165991500	36.049023	36.818851	36.576443	37.2856061500	36.818851	36.443138	36.549702	36.5764431500	36.576447	36.845982	36.443138	36.4166071500	36.845985	36.576447	36.310814	35.8937531500	36.576443	36.845978	36.549706	37.2856062000	36.818851	35.919533	36.284462	36.8459822000	36.576439	36.416603	37.147099	36.4165952000	36.310822	36.845982	36.576439	36.8459742000	37.257824	36.416607	36.845978	36.8459782000	36.310814	36.416607	37.257824	36.8459782500	36.845982	36.576443	36.284466	36.1532822500	37.285599	36.845985	36.818851	36.5764392500	36.049023	36.416607	36.845982	36.8459852500	37.257828	36.845982	36.845982	36.4166032500	36.576443	36.310814	37.257816	36.5764473000	36.845985	36.416607	36.845982	36.5497063000	36.845982	36.845978	36.982243	36.1532903000	36.576447	36.845982	36.576439	36.8459823000	37.257820	36.153286	36.310818	36.8459823000	36.576443	36.153294	36.845982	36.9822463500	36.845982	36.416607	36.982250	36.4431383500	36.818851	36.845985	37.285603	36.4166033500	36.710720	36.416603	37.285606	36.8188483500	36.845985	36.416599	36.576431	36.5764433500	36.982243	36.845978	36.845978	36.4166034000	36.576447	36.576443	36.710720	36.4166034000	37.009617	36.416607	36.845985	36.8459744000	37.257820	36.845985	36.310818	36.4166034000	36.982246	36.416603	37.285606	36.4166034000	37.257824	36.416607	36.576443	36.4166074500	37.009621	36.845985	36.710709	36.4166074500	36.845985	36.416599	37.285603	36.8188514500	37.285610	36.416595	36.845985	36.4166074500	37.257820	36.443142	37.397156	36.0230524500	36.982246	36.443142	36.982250	36.8459825000	36.845982	36.818855	36.576447	36.4166035000	37.285603	36.845985	37.257820	36.0230485000	36.982243	36.416595	36.845982	36.5764395000	36.576435	36.818855	37.285606	35.9971125000	37.285599	36.818855	36.845974	36.4165995500	37.425148	36.443142	37.257816	36.4165995500	36.576447	36.416603	37.707390	36.0230525500	37.257824	36.416599	37.009617	36.4166075500	37.425148	36.416599	36.310818	36.4166075500	37.009617	36.416599	36.310822	36.8188556000	37.009621	36.416599	36.982250	36.0230566000	37.425140	36.416595	37.257824	36.0230566000	37.707386	36.416603	36.845985	36.1532976000	37.285603	36.818851	37.285610	35.9971206000	37.009621	36.416607	37.257824	36.0230526500	36.982250	36.023052	37.257816	36.0230606500	37.850113	36.023056	37.425148	35.2112626500	37.593975	36.416607	37.009621	35.9971126500	37.593983	35.612534	36.982254	35.6125416500	37.425144	36.845974	36.576447	36.4165997000	37.425140	36.023056	36.549702	34.4827547000	38.022820	35.612537	36.982250	34.8432047000	38.789753	36.416607	36.982243	32.7011077000	38.491142	35.612534	38.022812	34.8432047000	37.878792	35.997120	37.425148	34.1064077500	38.022808	36.416615	37.285606	31.7258837500	39.277298	35.612530	37.850109	33.7381867500	37.907497	35.997112	37.425148	32.3834157500	38.491150	35.612530	38.314178	31.7258837500	38.669762	35.997108	37.285603	32.7011078000	38.491146	34.083164	38.343559	30.8071468000	38.789757	35.211266	37.878784	29.1375248000	38.639877	35.236076	37.850109	31.4267698000	39.246471	35.236076	38.314175	29.6735848000	38.372978	34.818939	37.878788	30.2297368500	38.789761	34.106411	38.491138	29.9401178500	38.491142	33.738194	38.819874	29.6735868500	38.343559	34.965031	38.022816	29.6735868500	38.491150	33.046921	38.940811	30.2480288500	38.461536	33.738190	38.491142	28.3607439000	38.491142	29.673588	38.491142	28.8850319000	38.461536	32.383419	38.491142	28.2007859000	38.314171	32.488625	38.971157	28.8683559000	38.491146	33.046921	38.940811	28.6204879000	38.491138	32.701107	38.491138	28.8683579500	38.197094	30.807144	38.197094	26.2743009500	38.491142	30.229740	38.491142	27.1591479500	37.907494	29.958052	38.940807	26.9396469500	38.491142	31.725882	38.491142	27.1591479500	38.491138	31.113873	38.491142	28.10566910000	38.491142	29.137524	38.940807	26.93964810000	38.197086	28.868357	38.971157	25.83978810000	38.197090	29.137524	38.639874	25.64102010000	38.491146	29.411762	37.907501	25.83978710000	38.491146	29.958057	38.167938	26.70939410500	38.491142	28.885031	38.461533	25.64102710500	38.343559	29.673588	38.491142	24.46183410500	38.491146	27.397257	38.461540	25.05008910500	38.461536	28.885031	38.491142	25.22703410500	38.197105	29.137522	38.940807	25.05008911000	38.461536	28.121479	38.491142	25.03754411000	37.453186	27.639574	38.759689	24.10799611000	38.022808	28.200787	38.940804	24.10800011000	38.022816	28.105671	38.971161	24.27183311000	37.764347	28.105673	38.491142	24.28363211500	37.735847	27.397253	38.491138	22.89376411500	38.461540	26.939651	38.197094	21.80549011500	38.461536	25.641018	38.491150	22.89377011500	38.491142	27.159149	38.491138	22.89377211500	37.735851	26.939648	38.461533	23.23419612000	37.735840	26.055229	38.314171	22.26179312000	38.789757	26.483047	38.491146	22.89376812000	38.022808	25.641020	38.314167	22.31146412000	38.491142	26.709396	38.022808	22.57335912000	38.022808	26.497078	38.461533	22.10433012500	37.764351	25.432348	38.789753	20.67824612500	38.022812	24.096380	38.491142	21.08814612500	38.022820	26.055229	38.491142	22.25188612500	38.051746	24.461832	38.491142	21.65439412500	38.022812	24.283632	38.789757	21.80549013000	38.639877	23.923443	38.461536	20.03204913000	38.491142	24.283625	38.022812	21.23142113000	38.022812	24.654840	38.461536	20.95557013000	38.022820	24.283627	38.461533	21.23142113000	38.022812	24.461830	38.051746	21.07925613500	38.051746	24.096380	38.491138	19.77847913500	38.343552	22.727270	38.022808	20.16128713500	38.461540	23.573778	38.022816	20.67824213500	37.907501	23.223408	38.491146	20.28397413500	38.022808	23.923441	38.022816	20.54231514000	37.878784	22.573362	38.022816	18.31502014000	38.022804	22.893770	38.022816	19.07668914000	38.197094	23.397280	38.491138	19.19385514000	37.285606	22.573362	38.789753	19.30501914000	38.022812	23.062725	38.022812	18.85369514500	38.022812	21.367517	38.022812	18.10938314500	38.197094	21.367517	38.022812	18.21493514500	38.022804	22.104330	38.491150	18.52537714500	38.491146	22.727264	38.491142	18.20830314500	37.593983	22.251890	38.022808	18.31502215000	38.051746	21.505371	37.593983	18.31501815000	37.285606	21.088146	38.022804	18.31501815000	38.343552	21.505373	38.491142	18.42298915000	37.850109	21.949074	38.051750	17.41553515000	38.022808	21.805490	37.735851	17.90831215500	38.022816	21.367517	37.593983	17.41553515500	38.491142	20.416496	38.314171	17.42160215500	38.022808	20.542315	38.022816	17.27115815500	37.735840	21.088144	37.735844	17.70538515500	37.878788	21.088148	38.197098	17.41553516000	37.313431	20.542315	38.022820	16.78415716000	37.735840	20.032051	38.022812	16.43655416000	38.022816	18.853699	37.735840	17.14089816000	38.022812	19.912382	38.491146	16.60577816000	37.565735	20.161287	38.022820	17.51313416500	37.593987	19.193857	38.022808	16.27074416500	38.022812	19.904459	38.022808	16.52346416500	37.593983	19.076687	37.565731	16.10824816500	37.593983	19.661814	38.022808	17.04739216500	38.022812	19.912382	38.022808	16.518003

Results:
Here's a plot - http://i.imgur.com/y7q17.png

The results show that it's more efficient to use smaller form lists. No effect on framerate was seen until around 8,000 iterations per second.


(Requested by Tarrant, assuming I understood correctly at 2:30 am)
Testing the performance of http://geck.gamesas.com/index.php/GetItemCount when using form lists of the same size, with one form list having all its items in the inventory being checked, and the other having only a portion of its items in the inventory being checked. I expect the code segments to be as efficient as one another.
Spoiler
Two form lists were used - "CCCTestFormList", containing 7 identical armour items, each of which was in the player's inventory, and "CCCTestFormList2", containing 3 items in the player's inventory and another identical 4 items which were not. Actual code tested:
set iTemp to player.GetItemCount CCCTestFormList ; Code 1; vsset iTemp to player.GetItemCount CCCTestFormList2 ; Code 2

Raw data obtained (frames per second):
Spoiler
IterationsPerFrame	Buffer1	Code1	Buffer2	Code20	40.064110	39.556961	39.556969	39.5882760	40.064102	39.556961	39.588284	39.5569650	40.064102	38.940815	40.064102	39.5882800	39.246468	39.588280	40.064110	39.5569610	39.556965	39.588280	39.246471	39.432171500	39.556969	39.277294	39.745636	39.556961500	39.588284	39.246464	40.064102	38.940807500	39.588276	39.246471	40.064102	39.277306500	39.556961	39.246464	39.745632	39.588280500	39.556965	40.064098	39.588291	39.5569611000	39.556965	40.064102	39.277294	39.5569611000	40.064106	39.556965	39.588280	39.2464681000	40.064102	39.277302	39.556961	39.5569651000	39.277298	39.745632	39.556965	39.5882841000	40.064110	39.556961	39.556969	38.9711571500	40.064106	39.556961	39.745625	39.0930401500	40.064102	39.556965	39.745628	38.7897571500	40.064098	39.556965	39.588280	39.2464711500	39.745628	39.588284	40.064106	39.5569651500	39.556969	39.588280	40.064110	38.7897572000	40.064110	39.556957	40.064098	39.5569612000	39.588280	39.556965	40.064102	39.2773062000	39.246468	39.556965	39.745632	38.1970902000	39.277302	39.556961	40.064098	38.7897572000	39.745628	39.246464	40.064098	39.5569652500	39.588280	39.246468	39.745625	39.2773062500	39.556961	38.940811	40.064110	39.5882802500	39.745636	39.246471	39.588280	39.5569572500	40.064102	38.789757	40.551498	38.7897572500	40.064098	39.588287	39.556965	39.5569613000	39.745625	39.588287	39.556965	39.5569693000	40.064106	39.588284	39.556965	39.2772983000	39.745636	39.556961	40.064106	39.0930373000	39.745628	39.556957	40.064098	39.0930403000	40.064098	39.556961	40.064106	39.0930403500	40.064110	39.588284	40.064110	38.6100393500	40.064106	39.556961	40.064098	38.7897573500	40.064102	39.556961	39.432171	39.5882763500	39.246468	39.556961	39.745625	39.5882803500	39.745632	38.610035	40.064102	39.0930374000	40.225266	39.093037	39.745625	39.5882764000	39.745625	39.062492	39.432175	39.0930404000	40.257648	39.062492	39.745628	39.5882804000	39.745632	39.093040	39.745632	39.5569654000	40.064106	38.610031	39.745625	39.0930404500	40.064098	39.093037	40.064098	38.1388244500	40.584408	38.610031	40.064102	37.7073904500	40.064106	39.093040	39.745628	39.0930374500	39.745628	38.610043	39.745628	38.6100314500	39.745625	38.610031	39.588280	38.6100395000	40.064102	39.093040	40.064102	38.6100435000	39.745625	38.610031	40.584419	39.0624965000	39.432182	38.639877	39.745628	39.0624925000	39.745632	39.093037	39.745625	38.1679425000	40.225258	38.610039	40.064102	39.0930405500	40.584412	39.093037	39.745632	39.0625005500	40.257648	38.610031	39.432171	39.0930375500	40.257645	37.707390	39.745628	37.2578205500	40.064102	39.093048	39.745628	37.7073975500	39.745625	38.610031	40.064106	38.1679466000	40.551498	37.707390	40.257645	36.8188486000	41.288193	37.707390	40.749802	39.0930376000	40.257652	37.707394	40.225262	36.4431576000	40.551498	36.416607	40.257648	36.4165996000	41.288193	37.707390	40.749794	36.4165956500	40.453075	35.997124	41.841003	35.6125346500	41.254124	35.612537	41.288193	35.6125306500	41.288200	30.807142	40.783035	34.8189436500	41.288189	36.845978	40.420368	34.8432086500	41.459370	35.612530	40.783035	35.9971207000	40.257648	33.156494	40.096233	33.7381907000	40.783039	33.738186	40.749805	32.7011077000	38.343559	35.236076	41.254124	33.0469217000	40.950039	33.738190	41.118423	32.7225077000	41.254124	33.738186	40.950039	33.4001277500	40.916534	31.746023	40.420376	32.0512817500	40.420368	32.701111	41.288189	29.9580527500	40.749798	32.383411	41.288197	33.0250977500	40.749794	33.046925	40.420372	31.1332427500	39.904228	31.847126	40.420372	31.4267758000	41.288189	31.426771	40.950043	28.8683578000	40.420372	31.113873	40.783035	29.6735848000	40.950047	30.525021	40.749805	29.9580558000	40.749798	29.673584	40.617386	29.6735888000	41.288189	30.525028	41.254124	29.9580548500	39.936100	28.868355	40.420372	28.1214758500	40.420372	29.673586	39.808918	29.1375268500	40.584415	29.411760	40.950050	29.6735868500	39.936100	28.868357	40.749798	29.1375248500	40.617390	29.673586	40.950043	29.1375229000	40.950043	28.105671	40.096233	26.9396509000	40.617382	26.709398	40.950050	27.1591459000	40.617386	27.870674	40.420368	27.6243049000	40.950039	28.620487	39.777245	27.3972559000	40.420372	28.105671	40.950039	26.0552319500	40.453072	27.382252	40.950043	26.2743009500	40.420372	26.709396	40.096233	26.2742989500	40.950039	26.483046	40.950047	26.2742989500	40.950039	26.709394	40.950039	25.0375509500	40.950043	25.227036	40.950043	26.70939610000	40.950039	25.432344	40.950043	24.85088710000	40.420368	24.096384	40.950039	24.28362510000	40.916538	26.068815	40.916527	25.05008910000	40.420368	26.274298	40.916538	24.85088510000	40.617386	25.037552	40.420368	25.03755010500	40.420372	24.850885	40.950043	24.28362710500	40.096230	25.037546	40.617382	24.28362510500	40.420368	24.461830	40.617386	24.28363210500	40.420368	24.461838	40.950039	24.46183010500	40.453072	24.654821	40.420368	24.65482111000	40.950047	23.741680	40.916534	23.23419411000	40.420368	23.223406	40.420372	22.57335911000	40.950043	24.096380	40.420368	23.57378011000	40.420372	24.461832	40.420376	23.74168611000	40.420376	23.234196	40.916538	23.39728211500	40.420372	21.958712	40.950043	22.56317311500	40.453075	23.223402	40.420368	22.41147211500	40.420376	22.737604	40.420368	22.10432611500	40.950039	22.251890	40.420376	22.10433011500	40.453072	22.893764	40.420368	22.25189012000	40.453075	21.795986	40.453083	21.36751712000	40.420368	21.367517	40.420368	22.26179112000	40.420368	21.505373	40.950039	20.41649212000	40.420372	21.949078	40.453075	21.94907412000	40.420372	22.104326	40.950039	21.08814812500	40.420372	21.222406	40.453072	20.15316212500	39.936100	21.367517	40.420364	20.81598312500	40.916527	21.805494	40.420368	20.81598312500	40.420372	20.678246	40.950043	20.54231512500	40.420376	20.550758	40.420372	20.81598113000	40.420368	19.661819	40.420372	19.91238213000	40.420368	20.408163	40.453075	20.28397413000	40.096233	20.283972	40.420372	19.78630613000	40.257648	20.416496	40.420368	20.41649413000	40.096230	19.904455	40.420372	20.16128913500	39.936100	19.584801	39.904228	18.31502213500	40.420376	19.786304	40.420376	18.31501813500	40.453075	19.778479	40.257645	19.54652013500	40.420368	19.786304	40.420368	17.22949213500	39.745628	18.747658	40.420372	19.18649314000	40.453079	18.315018	39.904224	18.74765414000	39.904224	18.214939	40.420368	18.00504114000	40.420372	18.315020	40.420376	17.90831214000	40.420368	18.853697	39.936104	18.31502214000	39.904228	18.422989	40.420368	18.42298914500	39.904224	17.711655	40.420368	17.90189714500	40.453075	18.315016	40.096230	17.51313414500	40.420372	17.806267	39.936115	17.90189714500	39.936100	18.315018	40.096233	17.90831014500	40.420368	18.208302	40.420376	18.21493515000	40.420368	17.705383	40.128418	17.51313415000	39.904232	17.908308	39.904236	17.23543715000	39.904240	17.611835	39.777248	17.42160215000	40.420368	18.005041	40.453079	17.60563515000	39.936100	17.611835	40.420380	17.32501815500	39.936104	16.265453	40.420372	16.43655615500	40.453072	16.518005	40.420376	17.14089815500	40.420376	17.235435	39.904232	17.05320515500	39.904228	17.047392	40.453072	17.22949815500	39.277294	17.550018	39.936104	16.954901

Results:
Here's a plot - http://i.imgur.com/qroO6.png

The results seem to show that both methods are just as efficient.


(Requested by schlangster)
Testing the efficiency of checking a variable before setting it so that it's only set once (only comparing the act of checking it) and setting a variable every frame. I expect checking the variable to be more efficient than checking it.
Spoiler

Actual code tested:
if bTemp == 0	set bTemp to 1endif; vsset bTemp to 1
The variable being used, "bTemp", was set to 1 throughout the test.

Raw data obtained (frames per second):
Spoiler
IterationsPerFrame	Buffer1	Code1	Buffer2	Code200	59.382446	57.937447	58.685474	59.3120120	59.382446	59.382446	59.312004	59.3824420	59.737186	59.382450	59.312004	59.3824420	58.616669	60.532711	59.312012	59.3824500	59.312008	58.685471	59.382446	60.459518500	59.312012	59.382446	59.382446	59.312004500	60.459518	58.685467	58.685474	59.312012500	59.382442	59.312008	60.532711	59.312012500	58.685467	58.616669	58.004662	59.312008500	60.532711	58.616676	59.382446	59.3120081000	59.382442	59.382446	60.459518	59.3120121000	59.382442	59.382446	59.312004	59.3824421000	60.459522	59.382450	58.616665	59.3824421000	60.459522	59.382450	58.616673	58.6854711000	58.616669	59.382442	60.459522	59.3824461500	59.312012	59.382446	58.685467	59.3120041500	60.459518	59.382446	59.382446	59.3120081500	59.382442	59.312008	60.532711	59.3120121500	59.382446	58.616665	59.382442	59.3120081500	60.532711	59.312012	59.382442	58.6166692000	60.532711	58.275082	59.737186	59.3120122000	59.382442	59.382446	60.459518	58.2750852000	59.031898	58.685474	59.312004	59.3824422000	60.459522	58.685478	58.616669	59.3824462000	59.312008	59.382442	60.459522	58.6854672500	59.312008	59.382446	59.382446	59.3120042500	59.737186	57.603714	59.101673	59.3120042500	60.459518	57.603703	59.737186	59.3824462500	59.382446	59.312004	60.459518	58.2750822500	59.808636	58.616676	59.382442	59.3120083000	60.532711	54.466259	59.737179	59.3120123000	59.382442	59.382446	60.459518	59.3120123000	58.685471	58.275085	59.031898	59.3824423000	59.737183	59.382450	59.312004	58.6854713000	60.459522	52.410915	60.901367	58.0046653500	59.312008	58.685467	57.339474	57.6037103500	59.737183	59.312012	58.685471	59.3120083500	60.532711	56.306332	59.737183	58.6166733500	59.382442	55.679306	60.901363	58.2750853500	59.031895	59.382450	59.312004	59.3824424000	59.737186	57.603714	59.737179	59.3824504000	59.312008	58.685471	59.737186	58.6854784000	58.616669	59.382446	60.459522	58.2750824000	59.737186	56.625168	59.737179	57.3394704000	60.459518	57.603710	59.737183	59.3824504500	58.616669	58.275082	60.901367	58.2750854500	59.737183	58.275085	59.737179	59.3824464500	60.459522	58.275085	59.031895	58.6854744500	59.312008	59.382446	59.737183	58.2750824500	59.737183	58.275082	59.101673	57.9374475000	60.459522	55.309757	61.274532	59.3824505000	59.312004	57.603703	60.901367	57.6037105000	59.031898	58.275082	60.901367	58.2750855000	59.737186	55.991062	60.096180	58.6854715000	59.737186	57.273792	60.827274	59.3824465500	57.937447	55.309753	61.274536	58.2750855500	59.737186	50.864723	61.349720	58.2750855500	59.737179	56.242992	60.168495	59.3120045500	60.459518	55.309750	61.274532	57.6037145500	58.685467	56.179798	61.349720	57.6037186000	59.737183	52.521027	61.349716	57.6037146000	59.737179	51.706326	60.532711	58.2750826000	60.901367	50.864712	60.606087	56.5611086000	60.168495	50.864716	60.532719	55.6173786000	59.453053	50.864716	61.274532	56.6251686500	60.168495	49.309673	60.096180	57.2737966500	61.274536	49.309681	60.606083	58.2750856500	60.827274	48.590881	59.453053	57.2082636500	61.274532	49.309673	60.168495	57.2737926500	61.274536	49.309673	61.274532	54.3478477000	61.274532	45.787552	60.168495	55.2486387000	59.453056	47.125366	61.349720	53.4188237000	60.532707	45.787556	59.453056	55.2486427000	61.274536	45.787556	61.349720	54.2888417000	61.349716	47.125359	61.274532	55.3097537500	60.096184	43.327564	60.901367	50.0500727500	61.349720	43.898163	61.274536	50.9165127500	61.274536	43.327564	61.274536	52.5210277500	61.349716	43.290054	60.168495	50.8647197500	61.349716	45.126358	59.453056	51.7063268000	59.453056	42.158516	60.168491	50.0500648000	60.606083	42.158516	61.274544	47.1698238000	61.274536	39.556961	60.168495	47.8468978000	59.808640	41.118423	59.808636	49.3096818000	58.754421	43.290043	60.168495	49.3096818500	61.349720	40.064098	60.096184	46.4684078500	60.168491	39.556957	61.349720	45.1263668500	61.274536	40.584415	59.453060	46.4252668500	60.168495	41.631973	60.168495	47.8469018500	60.532715	39.093040	61.274532	47.8468979000	61.274536	37.707382	60.168495	45.7875569000	60.532707	38.639877	61.274536	45.1263589000	59.453053	38.610031	59.453056	45.7875529000	60.168499	37.257813	59.453056	45.7875529000	60.606087	37.707386	60.096184	45.7875569500	59.880257	37.707382	61.274536	43.3275649500	59.453056	36.818859	60.168499	39.5882769500	60.096180	37.285599	61.274536	42.1585209500	61.349720	35.997120	60.168499	41.6319779500	60.532711	36.443153	60.096184	43.93673710000	60.096184	34.482758	61.274536	41.08462910000	60.606083	36.416599	59.031902	42.15851610000	59.453056	36.023052	59.453056	41.59734310000	61.349716	35.612537	60.168495	42.73503910000	60.096180	35.612530	60.168495	41.08463310500	60.168499	33.377834	59.453056	40.06409810500	61.349716	34.458988	60.168499	38.61003910500	61.274532	33.400127	60.096184	39.09304010500	60.168495	34.843197	60.168495	40.55149810500	60.606083	34.458988	60.168495	39.55696111000	60.901367	31.725887	60.168495	39.55695311000	60.168499	32.701107	59.101677	38.13882411000	60.168491	32.362457	60.606087	37.70739711000	60.168495	31.407028	60.168495	37.70738211000	60.168495	31.725883	59.453056	39.58828711500	60.096180	32.051277	59.101677	36.41659511500	60.168495	31.725882	59.031898	37.70738211500	58.343082	31.426771	59.031902	37.28559911500	60.532715	30.826136	60.168499	36.41659911500	61.274536	30.826136	60.096184	38.16793112000	60.168499	30.807142	59.101685	36.41660312000	61.274532	31.113873	60.168495	35.61253012000	60.168499	31.113871	59.453060	36.84598212000	60.168495	30.525024	60.096184	36.02304512000	60.168503	28.868355	58.754425	36.845974

Results:
Here's a plot - http://i.imgur.com/AtSVC.png

The results show that it's more efficient to set a variable every frame than it is to check its value instead, contrary to my hypothesis.

I'd like to do further tests to see if this indicates that there is some script optimisation going on in the background if a script tries to set a variable to the value that it is currently storing.


(Requested by JustinOther, following up on schlangster's request)
Testing the efficiency of two methods of checking a variable before setting it so that it's only set once (only comparing the act of checking it) and setting a variable every frame. I expect the "slow check" to be considerably less efficient than the other two code snippets, and the "fast check" to be slightly faster than the "set" command.
Spoiler

Actual code tested:
if bTemp == 0	set bTemp to 1endif; vsset bTemp to 1; vsif bTempelse	set bTemp to 1endif
The variable being used, "bTemp", was set to 1 throughout the test.

Raw data obtained (frames per second):
Spoiler
IterationsPerFrame	Buffer1	Code1	Buffer2	Code2	Buffer3	Code30	59.312008	60.532711	57.937454	59.382446 58.616673 58.6854630	60.459522	59.382446	59.312012	59.382442 58.685467 59.3120040	60.459518	59.382446	58.685467	59.312004 58.685467 60.4595180	59.312012	58.685467	59.382446	59.312004 58.685463 60.4595220	59.382450	59.312008	59.382442	58.616669 59.382442 60.459522500	59.382450	58.616676	59.382442	59.382446 59.312004 59.382446500	59.312012	58.685467	58.004662	58.616669 59.737179 59.382446500	59.382446	58.616669	58.685463	58.616669 59.808632 57.937454500	59.382446	59.312008	59.382442	60.459522 59.382446 58.616673500	58.004658	58.275085	58.616669	58.685471 59.031898 59.3824501000	59.312008	58.685471	59.382446	60.459518 57.937450 58.2750821000	59.808636	58.616665	59.737186	56.306332 59.382446 59.3824501000	58.616669	59.382442	60.459522	58.275085 58.685474 59.3120121000	58.004665	59.312008	59.808643	58.616673 59.382450 59.3120121000	59.382442	59.382446	60.459518	57.603714 58.616673 59.3824461500	58.616669	56.053833	60.459522	59.382446 59.312012 59.3824461500	59.382446	59.312008	60.459518	59.382446 59.382446 58.6166691500	59.382442	59.312008	60.532711	58.616673 59.382442 59.3120081500	58.685471	58.685471	59.737183	59.312012 59.382442 59.3824461500	60.459518	58.616676	58.685471	58.685471 59.312004 59.3824422000	60.459522	58.275085	59.031898	59.382446 59.312008 59.3824422000	60.459522	59.382450	58.616669	59.382446 59.312008 58.6854712000	60.459522	58.685467	57.937447	59.382446 59.382446 59.3120042000	60.459522	56.947632	58.685471	59.382446 59.312004 58.6854712000	60.459518	56.689358	59.312004	58.685471 58.616673 57.6037142500	59.808640	54.112564	60.168491	59.312008 59.808640 58.2750822500	59.031902	57.273785	59.382442	59.382446 60.459518 55.6793142500	59.031906	58.004662	59.312008	59.382446 60.459518 59.3120122500	58.685471	59.382450	59.312004	58.685463 59.737183 58.6854712500	59.312004	59.382446	58.616669	58.685474 59.737186 59.3824463000	58.616669	57.339466	59.737183	55.066113 59.737186 58.6854673000	58.685467	57.603699	60.827274	57.603714 59.808636 57.2738003000	59.382442	59.312008	60.532711	58.616673 57.339474 55.9910623000	59.382442	59.382446	60.459522	58.616680 59.382442 59.3120083000	60.532711	56.561104	60.168503	59.312012 59.382442 59.3824463500	59.737183	57.603710	60.459522	55.432407 59.312004 59.3824423500	60.459522	58.275085	59.031898	58.685474 59.312008 57.3394743500	60.459522	57.603703	59.737183	53.648094 59.382446 59.3120043500	58.275085	56.625160	60.827274	55.432404 59.382446 59.3120043500	60.459518	57.273785	60.901363	58.616673 59.382446 59.3120044000	59.737186	58.275082	59.808636	56.625172 59.382442 54.1712114000	59.101685	58.275082	59.737179	57.273796 60.532711 56.9476244000	59.031902	57.937458	58.685471	58.004665 60.459518 54.4662514000	59.737183	56.947636	59.737179	58.685471 60.459522 58.2750854000	59.737179	57.339478	60.459522	57.603714 60.459522 58.2750824500	59.031898	57.603703	60.901367	58.275089 59.737186 57.6037144500	59.737183	57.603714	60.901367	58.275085 59.031902 59.3824464500	58.004658	58.275082	60.827274	56.306332 59.808636 59.3120084500	59.382442	58.275085	60.901363	58.275082 59.031895 59.3120084500	60.532711	57.208263	60.901363	59.312012 58.685471 58.6854715000	60.459518	53.705715	60.606087	58.275085 59.031895 59.3824505000	59.312004	53.418819	60.606087	57.603714 59.031902 58.2750855000	59.031902	56.561111	61.349720	56.947628 59.737183 58.6166765000	58.685471	57.208263	61.349720	57.603710 59.737183 58.0046655000	58.616669	57.273792	61.274536	58.275085 59.737179 58.6854745500	59.312008	51.706329	60.606083	59.312012 58.685467 56.9476325500	59.737179	52.521030	60.168495	59.382446 58.616669 58.6854745500	60.459522	54.347851	61.274532	57.273785 60.096180 56.9476325500	59.808640	54.288834	61.274536	56.947639 59.101677 58.2750825500	60.827274	52.576252	60.975636	57.603710 59.737179 58.2750856000	59.737179	49.309681	61.349716	57.208263 61.274532 56.2429896000	61.349720	51.652908	61.349720	58.275089 59.737179 55.2486466000	60.168495	51.706326	60.168495	56.179802 59.808636 58.2750826000	60.827278	50.916512	60.532715	57.208263 58.411240 53.4188236000	60.532707	47.846897	61.274536	57.208263 59.453053 55.2486426500	60.168495	47.846897	60.532711	55.309753 60.096180 53.4188236500	60.168495	47.846901	61.274532	55.309753 60.532707 56.2429926500	59.453056	47.125370	60.532715	56.242992 60.168491 55.2486386500	60.532707	46.468407	61.274536	56.242996 60.168495 54.3478476500	59.808632	49.309673	61.274532	55.309757 60.096180 54.3478517000	59.808628	42.735039	61.349720	53.418819 61.274536 53.4188237000	61.274532	45.787552	60.168495	50.864719 61.349720 50.8647167000	61.274536	46.468407	60.532707	53.418823 59.453056 53.4188277000	61.349720	45.126358	60.168499	53.418819 61.274532 50.8647167000	61.349720	45.787556	60.532711	51.706329 60.168491 50.0500687500	60.168499	43.898159	61.349716	50.050068 59.453056 48.5437017500	61.349720	42.158516	60.606087	47.801159 60.606083 50.8647127500	60.168491	43.290051	60.168495	50.100216 61.274536 47.8469017500	61.728416	42.158520	60.606087	50.050072 60.168495 50.1002127500	60.532711	43.898155	60.168495	50.100216 59.808636 48.5908818000	60.096184	41.118420	59.382450	47.169823 61.274532 46.4684148000	61.274536	41.084629	59.453053	49.309673 61.274532 47.1253598000	60.168499	41.084633	60.168495	50.100216 60.168495 47.1253668000	60.532715	42.194092	60.096184	48.590881 59.453053 47.8011598000	61.349720	40.551498	60.606083	48.543701 60.606083 47.1253668500	61.274536	38.610043	60.168495	43.898163 58.754425 43.8981638500	60.606087	40.064102	59.031902	46.468414 61.274536 45.7875528500	60.168495	39.062500	60.606087	44.523602 61.274536 43.8981598500	59.453056	39.093037	61.274536	46.468407 60.168491 45.7875568500	60.096180	39.588284	61.274536	46.468407 60.532711 45.1671229000	61.274536	37.707382	60.168499	43.898159 61.274529 41.6319739000	60.168491	36.416607	61.349716	43.898159 59.453056 42.1585209000	60.168491	37.257816	59.453053	45.126362 60.168499 42.7350439000	61.274532	37.285603	60.168495	43.898163 60.168495 42.1585249000	60.168499	37.257816	60.168495	45.126362 60.168495 41.6319819500	60.168491	36.416599	59.453053	43.290051 58.411240 41.0846379500	60.168495	36.818855	60.168495	43.327553 60.168495 41.0846419500	60.168495	36.416607	60.096180	41.631969 61.349720 42.1585169500	60.168499	34.458988	60.168495	41.631969 61.274536 40.0641069500	60.168491	36.416595	59.453053	43.898159 58.754429 40.06410210000	61.274532	34.843201	59.737183	40.064098 60.168495 39.09303710000	60.168495	34.083160	59.453056	40.584412 58.004662 40.58441210000	61.274536	35.612534	60.168499	41.084633 60.168499 40.06409810000	60.168491	34.458992	60.532715	40.064102 61.349720 40.55149810000	61.349720	35.211262	61.349720	41.597336 59.453056 41.08462910500	60.168495	32.701107	59.453056	40.064095 60.901363 38.16794210500	59.382446	33.400131	60.168495	39.062492 59.453056 38.16794610500	60.096184	32.722504	60.096180	38.639877 60.096184 37.70738210500	60.168499	34.106411	58.343082	37.707390 60.168495 37.25782410500	60.168495	33.046921	59.453056	37.257828 59.031898 38.16793811000	60.168499	32.051277	59.031902	38.138824 59.453056 35.61254111000	60.168495	30.826134	60.096180	37.285610 59.382446 36.02305611000	60.168491	32.362457	59.453060	36.845985 60.168495 36.41659911000	60.168495	31.426769	60.096184	38.167938 60.168491 36.41659911000	59.453053	31.725880	59.453056	37.707386 61.274532 37.28559911500	60.168495	31.113874	60.168495	36.416603 61.274532 35.61253411500	60.168499	30.525024	60.168499	36.416595 61.274536 35.61253411500	60.168499	31.113874	60.168495	36.845978 60.168495 35.21126211500	60.168499	29.958054	60.096184	34.843197 59.453056 35.21126211500	59.453056	31.113873	60.168495	36.416603 59.453056 36.02304512000	59.453056	30.229740	60.168495	34.843201 59.382446 34.84320412000	60.168495	29.394470	60.168495	36.023052 60.168495 35.21126212000	60.168499	30.229740	60.168499	35.612530 60.168495 34.08316412000	58.754425	29.958052	60.168495	35.997120 59.453053 35.23607612000	61.274536	29.673588	59.031906	35.236076 59.453056 34.458992

Results:
Here's a plot - http://i.imgur.com/rOl8j.png

The results show that the slow check is considerably less efficient than the fast check and setting the variable every frame. The fast check seems to be very slightly less efficient than setting the variable every frame.

Testing the efficiency of checking variables in various locations. I expect local variables to be fastest, followed by global (quest) variables and then by remote (quest) variables.
Spoiler

Actual code tested:
if iTempendif; vsif CCCTempQuest.iTempendif; vsif CCCTempGlobendif

Raw data obtained:
Spoiler
IterationsPerFrame	Buffer1	Code1	Buffer2	Code2	Buffer3	Code30	55.991055	59.312008	59.382442	60.459522 59.382450 58.6166730	59.382442	59.382446	60.459518	59.312012 59.382446 59.3824460	59.312004	59.382442	59.737183	58.004673 59.312012 59.3824420	59.312008	57.339470	60.459522	58.685474 59.312008 59.3824420	59.312008	59.382442	59.737183	57.603714 59.382446 59.312008500	59.382442	59.382446	60.459522	59.312012 59.382442 58.685471500	59.312004	59.382442	60.459522	59.382450 59.312004 58.685471500	59.737186	59.382450	59.312012	59.382446 59.312008 58.685471500	60.459522	58.004669	59.312012	58.685471 59.382446 59.312004500	60.459518	59.382446	58.275085	59.382446 57.937447 59.3824421000	60.459518	58.275085	58.275089	59.312012 59.382442 59.3824461000	60.459518	59.312012	58.275085	59.382446 59.382446 57.9374471000	59.737190	56.689377	59.382446	59.312004 59.382442 59.3120081000	59.808640	55.928429	59.737186	58.004658 59.312008 59.3824421000	60.459522	59.382446	59.312008	59.382442 59.382446 59.3120041500	59.737186	56.625160	60.168495	58.616665 59.382442 58.6166731500	59.382446	58.275089	59.312008	59.382446 58.685467 57.9374471500	59.031902	59.382446	59.382446	59.312008 58.685471 58.2750851500	58.616673	59.382446	58.685467	59.312008 59.382442 58.2750851500	60.459522	58.685474	59.312004	59.382446 59.312008 59.3824422000	60.459522	58.685467	59.312008	59.382442 58.685467 59.3120042000	60.459518	58.004669	59.382446	59.312004 60.459518 57.2737922000	59.737183	59.382450	59.312008	57.603703 59.382446 57.6037032000	59.312012	57.273792	58.343082	59.312012 59.382442 59.3824462000	60.459518	59.312012	58.685471	57.603710 58.685467 59.3120042500	60.459518	58.004665	58.004658	58.275085 59.737179 57.9374542500	60.532711	59.312008	58.685463	59.312008 59.382442 58.6854672500	60.459522	57.208260	58.685467	59.312012 57.603714 59.3824422500	60.459522	57.603703	58.685471	59.312012 57.603703 59.3824422500	60.459522	57.603710	59.737186	59.382450 58.616669 59.3824423000	60.459522	57.273785	59.737183	59.312012 58.685463 57.3394783000	60.459518	56.561104	59.031906	58.685471 58.685467 57.6037033000	60.459518	54.644825	61.274536	59.382446 59.382446 57.9374503000	59.737186	58.275082	59.808636	58.616676 59.382442 57.6037103000	60.459522	56.947628	59.737186	58.004669 59.312008 59.3824423500	60.459522	58.275085	59.737179	59.382450 57.937447 59.3824423500	60.459522	56.625156	59.737183	59.312012 59.382442 59.3824463500	59.737183	56.561104	59.737183	58.685471 59.382446 59.3120043500	60.459518	58.275082	59.808636	58.275089 58.616669 57.6037183500	60.459518	56.625156	59.737183	58.685474 58.616665 58.2750854000	60.459518	57.603703	59.808636	55.371017 59.382442 57.6037144000	60.459518	57.208263	60.459522	59.382446 58.685467 58.2750894000	59.312004	56.306328	60.459518	57.603714 59.101673 57.6037144000	59.312004	59.382442	59.737186	57.208263 59.808636 58.2750894000	59.312004	57.603710	60.459518	58.275082 59.808636 59.3120084500	58.685463	59.312012	59.808640	56.306332 59.031902 53.5905914500	59.382442	57.603703	60.168491	58.275085 59.737179 58.6854714500	59.312008	56.947628	60.459522	57.273792 59.737179 57.6037184500	58.616669	57.273785	61.274536	53.590599 59.031902 58.2750934500	56.947628	56.561111	59.737183	58.275082 59.382446 58.2750855000	59.737179	58.275082	59.737183	55.991070 60.459522 58.2750855000	59.737183	57.273792	59.737179	58.616673 60.532711 55.9284365000	59.737186	54.347839	60.901363	59.312008 58.685471 59.3120125000	60.532711	57.208260	60.168495	57.603714 58.616669 58.6854745000	60.459522	55.617374	59.737183	59.382450 57.603710 58.6166765500	60.459518	53.763466	60.901363	58.275089 59.737183 59.3824505500	58.616669	55.248638	60.168499	57.273796 60.459522 56.5611085500	59.031898	57.273785	59.737179	55.617374 60.901363 58.2750895500	59.737183	57.208260	60.168495	59.382450 59.737179 56.5611085500	59.737186	58.275082	59.737183	58.004665 59.737183 55.6173826000	59.031902	55.248634	61.349716	58.275089 60.168499 56.1797986000	60.901367	56.242989	59.031898	57.273792 60.096180 55.6173716000	59.737186	53.418819	60.606083	57.208267 58.004665 58.2750896000	59.737179	56.242989	60.168495	58.275085 59.031902 58.2750896000	59.031902	56.242989	60.168495	57.603710 59.737183 56.5611156500	59.031902	54.347843	60.901360	56.179794 59.453056 53.7634626500	61.274536	54.347847	60.532711	52.854141 61.349720 57.2082606500	60.168491	55.248642	59.453053	55.248642 61.274532 57.2737926500	60.168491	53.418819	60.532715	56.242992 60.168495 58.2750896500	60.827274	54.347847	60.901363	55.248642 61.274532 58.2750857000	58.004665	48.543709	61.349720	50.864719 60.532711 54.3478437000	60.532703	53.418819	59.101677	53.361813 60.606083 54.2888417000	60.168495	51.706322	60.168491	51.706329 60.096180 54.3478477000	60.532707	50.100216	60.532703	50.916512 60.827274 54.3478477000	59.808628	52.576252	60.168495	54.288837 58.343079 53.4188197500	58.754425	46.468414	59.453060	49.309685 61.728420 50.8647167500	59.453056	50.050060	60.168495	50.864716 60.168499 51.7063297500	61.274532	48.590874	61.274532	50.864716 60.168495 52.5210277500	59.737183	47.846897	60.168499	49.309681 61.274532 53.4188197500	60.168499	49.309673	60.168495	52.521030 60.606091 51.7063298000	61.274536	45.787552	60.168499	49.309681 59.453056 50.8647168000	59.453056	46.425266	61.349716	47.125370 60.168495 49.3096818000	61.274532	45.787552	61.274532	48.590874 60.168495 49.3096818000	60.096184	46.468407	59.808632	47.846901 60.168499 50.0500648000	60.606083	47.846901	60.096180	50.100212 60.168499 50.0500728500	60.168499	44.523602	60.168495	45.787560 58.754425 48.5437018500	61.274536	45.787552	59.453053	47.125366 61.349720 45.1263668500	59.453053	43.327564	59.031902	44.523605 60.532711 47.8469018500	60.901363	45.126358	59.453053	47.125366 60.532711 48.5908818500	60.096180	45.167122	60.168499	47.125366 58.616669 49.3096819000	61.349720	43.898163	60.901367	45.787552 59.453056 47.1253599000	60.532711	43.898163	61.349720	44.523602 59.382446 47.1698199000	60.096184	41.118427	61.274536	45.126358 60.606087 45.7875529000	60.168495	43.290051	59.453056	45.787552 60.168495 46.4252669000	60.168495	43.327560	60.096180	41.118423 58.343075 46.6853499500	58.754417	41.084633	60.168495	42.735050 61.274532 45.1671229500	58.685471	42.194096	60.168495	42.158520 59.453049 43.2900519500	59.453056	40.584419	60.168495	41.084641 60.168499 44.4839869500	57.736744	40.551502	58.004665	41.631973 60.096180 43.3275609500	59.737179	42.158516	60.168495	43.898163 60.168495 43.89816310000	60.168495	40.064102	60.168499	41.631977 61.274536 42.19409610000	60.532711	40.064098	59.453060	40.064102 59.453056 42.15851610000	60.168491	40.064102	60.168499	41.084637 61.274536 42.19409610000	60.532711	38.610031	60.168499	41.084633 61.349720 42.73504310000	61.274536	40.064102	61.274532	41.631973 60.168491 42.73504310500	59.453056	38.610039	59.453056	40.064102 59.382446 41.11842310500	59.382442	38.167938	60.168495	40.064110 60.168495 40.55149810500	59.031902	38.639877	59.031902	38.610035 61.274532 41.11842310500	58.685467	38.639877	59.382450	39.588276 60.168495 42.15851610500	60.168491	37.257824	57.670143	37.707390 61.349720 40.55149811000	61.349720	37.257816	59.453056	38.610031 60.168491 39.09304811000	61.274536	35.612526	60.168495	37.257828 60.901367 39.55695711000	59.101677	36.818844	59.101677	37.257816 60.168495 40.06410211000	59.453053	37.257824	59.453049	38.610031 61.274536 40.06410211000	59.880268	37.707382	60.827274	38.639870 59.031902 39.09303711500	60.096184	35.612541	59.808640	35.612534 59.031902 39.09304811500	60.096184	36.845974	60.168495	37.707382 59.031898 39.58827611500	60.096184	36.443142	61.274536	36.416607 60.168499 38.61003111500	59.453056	35.211262	59.453056	36.023052 60.168495 38.13882111500	60.606083	35.587196	60.168499	35.612530 60.606083 35.99711612000	60.606083	34.458992	60.168495	33.738194 59.382450 37.70739412000	60.168495	33.738186	60.168499	36.023048 60.096184 37.28559912000	60.168495	34.818939	61.349720	35.612534 60.532711 36.41660712000	60.168499	35.612530	59.031906	35.612530 60.168499 37.25781612000	61.349720	35.612530	60.168499	35.612530 61.274536 37.70738212500	60.901360	34.458992	60.168499	34.843201 59.031895 35.36068012500	59.031902	33.738182	60.168499	34.083160 59.101677 35.99712012500	60.606087	34.083160	59.031902	33.738186 60.168499 35.61253012500	60.168499	33.738194	57.670139	34.458992 60.168499 34.84319712500	61.274536	34.106411	58.343079	33.377838 60.168499 34.45898813000	59.101677	32.701103	60.168499	33.025097 60.168495 33.73819013000	61.349720	32.362457	60.168499	33.377834 60.606087 34.84320113000	59.031902	32.362457	60.606087	33.377834 60.168495 34.84320113000	60.096180	33.046921	59.453056	33.738182 59.453064 34.45899613000	60.168495	32.362453	60.168499	33.738186 59.453056 33.73818613500	60.168499	31.113867	60.901367	32.051273 59.031902 33.04692113500	61.274536	30.525024	59.031902	32.722511 60.096184 32.38341513500	60.168491	30.807144	60.168499	31.725882 60.901363 32.38341513500	58.411232	31.113874	61.349720	32.051281 60.168499 32.36245713500	60.168499	30.525024	60.168499	31.426771 60.096180 33.73819014000	58.411243	30.807144	59.031902	31.746029 59.031902 32.05127714000	58.343075	30.525024	59.031902	30.525026 60.168495 32.70110714000	57.670155	30.525026	58.411236	31.407030 60.168495 32.38341514000	59.031902	30.525026	59.453053	31.426771 59.382446 33.04691714000	60.168495	30.826136	59.031906	31.725887 60.168499 33.04692114500	60.901360	29.394468	60.168499	30.826134 60.096184 31.13324714500	58.343079	30.339800	59.031902	31.113873 59.031898 31.42676914500	58.343079	29.673588	60.168495	30.525026 59.453056 32.05127714500	59.453060	28.360743	56.306320	29.673584 60.168499 31.72588214500	59.453056	30.248028	60.096184	31.426771 60.168499 31.72588215000	59.101685	29.137524	58.343082	28.868357 60.168495 31.11387115000	60.168495	29.137522	60.168495	29.394468 60.168499 30.82613415000	59.382450	28.885035	60.168495	30.525026 57.937458 30.82613415000	60.168499	29.394470	59.031902	29.958052 60.168499 31.42676915000	59.737183	29.411758	58.685474	29.958052 60.168491 30.525028

Results:
Here's a plot - http://i.imgur.com/HCPqD.png

The results show that global variables are most efficient, followed by remote (quest) variables and then local (quest) variables. Only a very small difference in efficiency was measured, and little effect was seen until about 5,000 iterations per frame.

I'd like to do a follow-up test comparing two methods of comparing local (quest) variables, like so:
if iTempendif; vsif CCCQuest.iTempendif


(Requested by Tarrant)
Testing the performance of http://geck.gamesas.com/index.php/GetItemCount when using the same form list on an inventory containing all its items, and on an inventory containing none of its items (that is the only difference between the inventories). I expect it to be more efficient to check the empty inventory
Spoiler

Actual code tested:
set iTemp to player.GetItemCount CCCTestFormList ; player's inventory contains all items in list; vsset iTemp to player.GetItemCount CCCTestFormList ; player's inventory contains no items in list
The player's inventory was altered at the end of the buffers prior to the testing of each code.

Raw data obtained:
Spoiler
IterationsPerFrame	Buffer1	Code1	Buffer2	Code20	59.382446	56.947628	59.312004	58.6854710	58.616673	60.532711	58.275082	59.3120040	59.382442	59.312008	59.737186	59.3824460	59.382446	59.312004	59.737179	59.3824460	59.382450	58.616673	59.382442	59.312008500	59.382442	60.459522	58.685474	59.312012500	59.382442	59.382446	60.459518	59.312012500	59.382446	59.382446	58.616669	58.685471500	60.459522	56.242992	59.737183	58.275085500	58.685474	58.616665	58.685463	58.6166731000	59.808632	57.273796	59.382442	59.3120081000	60.532711	58.275082	59.737183	58.2750891000	59.312004	59.382442	60.459522	57.6037101000	59.737186	57.603718	59.382442	59.3120081000	59.808640	57.208260	60.168495	57.6037141500	59.312008	59.382446	59.737183	58.0046651500	58.616673	58.685467	59.382446	59.3120041500	60.459518	57.603714	59.101677	59.3120081500	59.382442	58.616669	59.808632	58.6166691500	59.382442	56.625172	58.685471	58.0046622000	59.312008	58.275082	59.737183	58.6854712000	58.616669	53.821327	58.343079	58.6854712000	59.737183	58.685467	59.312008	58.6854632000	59.031902	58.275082	59.737183	58.2750892000	59.382442	58.004665	60.459518	58.2750852500	59.737183	58.004665	58.616669	55.4323922500	60.459522	58.275085	59.737179	56.6893692500	60.459522	57.208260	60.532711	53.3049322500	59.031895	57.208260	59.031898	55.6793142500	59.808632	56.306335	59.031895	57.9374623000	58.685463	58.275085	60.901363	55.9284363000	59.737179	58.275085	59.031898	57.6037103000	60.532711	57.208256	60.168491	58.6166733000	58.685463	58.275085	60.901363	52.9661293000	59.031902	58.275085	58.411236	57.9374543500	59.737186	55.309757	60.827278	57.6037103500	59.808636	56.179794	61.349720	55.9284323500	59.031906	54.347847	61.274536	58.2750823500	59.808636	57.208260	60.532711	57.6037143500	59.808636	55.555576	60.168495	57.6037144000	59.737183	45.787552	58.343082	53.7634624000	60.168491	47.846897	59.382442	58.6854744000	59.031898	51.706326	61.274536	57.2737924000	59.737179	53.418819	59.031898	55.9910664000	60.827274	50.916512	60.532711	56.2429964500	60.901363	47.801151	59.453056	55.2486384500	61.349720	45.787556	60.901363	55.2486384500	60.168495	47.125366	59.453060	50.8647234500	60.532715	47.846901	61.274532	53.4188234500	60.606083	47.801159	61.349720	55.2486425000	60.168491	43.898159	60.168491	50.8647165000	61.274532	45.167122	59.453060	49.3096815000	61.274532	44.523609	60.168495	50.0500725000	59.453053	44.523605	59.808636	51.7063265000	60.168491	44.523602	61.274536	51.7063225500	59.808640	41.631973	59.453053	47.8469015500	60.827278	40.584412	61.274532	47.1253665500	59.880257	42.158520	60.168495	47.1253665500	61.349720	38.610031	58.343082	45.7875445500	58.343082	38.610031	60.168499	47.1253596000	59.453053	39.588276	59.031906	44.5236026000	60.096184	39.093033	59.453056	42.7350506000	60.168491	39.556961	60.168499	43.8981596000	60.901363	39.093040	59.031902	42.9553306000	59.382446	39.093033	60.168495	43.8981596500	60.168491	36.416599	60.168491	41.6319736500	60.096180	36.443142	60.096180	42.1940966500	60.168495	36.416595	59.453056	41.0846376500	60.532715	36.845978	59.453053	41.0846336500	60.168499	35.612530	61.274536	41.0846337000	60.168499	33.400131	59.737179	40.0641067000	61.274536	33.400127	60.096180	39.5882877000	60.096184	33.400131	59.453056	39.0624967000	60.168499	33.400131	59.031898	39.0930487000	60.532711	32.383415	58.343079	37.4251407500	60.168495	31.725882	59.031898	37.2856107500	59.031902	32.051277	60.168499	36.8188557500	59.453060	30.826132	60.168499	37.7073947500	60.096180	32.051277	60.168495	38.1679467500	60.096184	32.383415	60.901363	37.2578288000	60.901367	30.826132	60.096184	36.0230528000	60.168499	31.426771	59.031902	35.2112698000	60.168499	31.426771	59.031906	35.6125348000	60.168495	30.229740	59.453056	35.2112588000	60.168495	31.113873	59.101677	34.0831578500	61.349716	29.137524	59.031898	33.7381868500	60.096180	28.620487	59.453056	33.7381908500	60.168499	29.137524	59.453056	34.4589928500	60.168495	29.673584	59.031906	31.7258838500	60.168499	27.639572	60.096184	33.738186

Results:
Here's a plot - http://i.imgur.com/OAWCn.png

The results show that it's considerably more efficient to check the empty inventory. No noticeable drop in performance was noticed until about 3,500 iterations per frame.



You can download the package that I've been using to perform these tests from New Vegas Nexus - http://www.newvegasnexus.com/downloads/file.php?id=37129

Let me know if you have any questions, requests, or suggestions.

Cipscis
User avatar
Jessica White
 
Posts: 3419
Joined: Sun Aug 20, 2006 5:03 am

Post » Fri Jan 22, 2010 12:22 am

I have a request :)

; Only enable onceif x == 0  set x to 1endif

vs
; Enable every runset x to 1

Lets say you want a variable to be always 1 when in MenuMode. Is it faster to set it only once by checking its state before, or to skip the check and just keep setting it to 1?

And, more interestingly, what about:
; Only enable onceif doOnce == 0  setUIFloat "blah" 1  set doOnce to 1endif

vs
; Enable every runsetUIFloat "blah" 1

User avatar
Harinder Ghag
 
Posts: 3405
Joined: Wed Jan 17, 2007 11:26 am

Post » Fri Jan 22, 2010 5:21 am

That will depend on how often the value of the variable you're trying to keep the same changes. For example, if it's reset to 0 every frame, then adding the conditional statement will do nothing but make the script less efficient. However, if you expect to only need to set the variables once, then the first iteration will be the same as the scenario I just mentioned, and once the first iteration has passed it'll just be a comparison between a "set" command and a conditional statement that evaluates "x == 0".

I'll run a test comparing the following two bits of code, with "bTemp" being 1 throughout the test, and post the results when I'm done:
if bTemp == 0	set bTemp to 1endif; vsset bTemp to 1
I'm expecting the first code segment to be more efficient.

I've never used UI functions before, could you tell me how I'd need to set up the UI files and the function call so that it works?

Cipscis

EDIT:

Results of the first test are up. The results were not what I'd expected, and may indicate some background optimisation going on when a script tries to set a variable to the value that it is currently storing. I'd like to do more tests to follow this up.

Cipscis
User avatar
Jinx Sykes
 
Posts: 3501
Joined: Sat Jan 20, 2007 11:12 pm

Post » Fri Jan 22, 2010 8:38 am

The setUIFloat command should execute with any parameter, though to make sure its fully executed its probably best to have a real UI element. You can add the following to your hud_main_menu.xml in the menus/ folder, before the closing

	<_debugTextValue> 1234 				 3 										


then execute setUIFloat "HUDMainMenu\_debugTextValue" 1

And yes, the first test basically boils down to conditional (branch + condition eval) vs set, and it wouldnt suprise me if set is faster. It'd just be interesting to know where it makes sense to check ifs really necessary to execute a command and where this redudancy check is more costly than just running the command again.
User avatar
Paula Rose
 
Posts: 3305
Joined: Fri Feb 16, 2007 8:12 am

Post » Fri Jan 22, 2010 7:34 am


The results show that it's more efficient to set a variable every frame than it is to check its value instead, contrary to my hypothesis.


* i had wondered about exactly that!!!! *

So okay. Interesting results on the formlist, thanks!

Do you feel like checking one more permutation?

See what sort of performance difference there is for:

checking an inventory getitemcount against a formlist when the inventory is completely empty - - vs: a) doing nothing at all, and, b) checking it with 1 or more items in there.
User avatar
Dj Matty P
 
Posts: 3398
Joined: Sat Jun 09, 2007 12:31 am

Post » Fri Jan 22, 2010 7:54 am

The results show that it's more efficient to set a variable every frame than it is to check its value instead, contrary to my hypothesis.

How 'bout, provided it's a boolean value...
if bTemp == 0	set bTemp to 1endif

vs.
set bTemp to 1

vs.
If bTempElse	Set bTemp to 1EndIf


For a bool like that, perhaps the '==0' threw the results off per the results of 'If x == 0' vs. 'If X/Else'? Something tells me that 'If X/Else' would be cheaper still than setting the var repeatedly.
User avatar
Stephanie I
 
Posts: 3357
Joined: Thu Apr 05, 2007 3:28 pm

Post » Fri Jan 22, 2010 7:03 am

The results to JustinOther's request are up. I'll run schlangster's and Tarrant's later and post the results when I'm done.

Cipscis
User avatar
victoria johnstone
 
Posts: 3424
Joined: Sat Oct 14, 2006 9:56 am

Post » Thu Jan 21, 2010 6:02 pm

The results to JustinOther's request are up. I'll run schlangster's and Tarrant's later and post the results when I'm done.

Cipscis
Interesting... Thanks. Being able to see it graphed out like that is amazing.
CipscisREF.GetAV ScienceGetActorValue: Science >> 9001
I wonder if bTemp were a GLOB if it might tip the scales in favor of the fast check. IIRC, globals are 'cheaper' to check than script variables, or was that only when checking remote variables?
User avatar
Nikki Hype
 
Posts: 3429
Joined: Mon Jan 01, 2007 12:38 pm

Post » Thu Jan 21, 2010 11:38 pm

If I remember correctly, I only compared the efficiency of checking global variables with remote variables and the results showed it to be more efficient to check global variables. When I eventually run a similar test for New Vegas I'll add checking local variables to the test as well, and possibly also compare the efficiency of setting them, although I'd expect to see similar results for both tests.

Cipscis
User avatar
JaNnatul Naimah
 
Posts: 3455
Joined: Fri Jun 23, 2006 8:33 am

Post » Thu Jan 21, 2010 8:11 pm

Your pics : scripting nuts :: Hubble pics : astronomy enthusiasts

Can't wait to see more :)
User avatar
Jason Rice
 
Posts: 3445
Joined: Thu Aug 16, 2007 3:42 pm

Post » Thu Jan 21, 2010 9:48 pm

yummy stuff
User avatar
James Shaw
 
Posts: 3399
Joined: Sun Jul 08, 2007 11:23 pm

Post » Fri Jan 22, 2010 10:11 am

I've finished testing the relative efficiency of accessing variables in different locations. Moving on to the other requests next.

Cipscis

EDIT:

Tarrant's last request is up.

Cipscis
User avatar
Rebecca Dosch
 
Posts: 3453
Joined: Thu Jan 18, 2007 6:39 pm

Post » Thu Jan 21, 2010 9:24 pm

Testing the efficiency of checking variables in various locations. I expect local variables to be fastest, followed by global (quest) variables and then by remote (quest) variables.
Actual code tested:
if iTempendif; vsif CCCTempQuest.iTempendif; vsif endif


Here's a plot - http://i.imgur.com/HCPqD.png
CCCTempGlob takes the gold! Thanks, Cipscis :) So, to revisit setting a var every iteration, may I request
If CCCTempGlobElse	Set CCCTempGlob to 1EndIf; vs.Set CCCTempGlob to 1; vsSet bTemp to 1
?

*bets on If GLOB/Else, then the others in the order posted*

It's like a horse race! :laugh: I'll stop pestering you now, but I'm just really curious about seeing them all graphed together, maybe even with the slow check versions.
User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Thu Jan 21, 2010 10:30 pm


Tarrant's last request is up.

Cipscis


Thankieee cipscis!!!

The test results aren't the happiest news for me though - - I guess I was hoping for the function to do next to nothing when run against an empty inventory. Comparing it to the controls, its clear that it's doing a notable bit of internal work - - and I have to guess some of it sorta unnecessary?

I feel like I should be able to check for an empty inventory via a really simple function which should take next to no processing. Then I could run involved formlist checking if there is in fact SOMEthing there. meh.
User avatar
Jade Barnes-Mackey
 
Posts: 3418
Joined: Thu Jul 13, 2006 7:29 am

Post » Thu Jan 21, 2010 6:17 pm

I'm not entirely certain that my inventory was absolutely empty - the game might add the pip-boy and glove when starting a game via http://geck.gamesas.com/index.php/CenterOnCell from the main menu - but it was certainly at least very close to empty, and emptier than I would ever expect to see the player's inventory during regular gameplay.

Cipscis

EDIT:

I'm not sure if it's implemented in NVSE yet, but FOSE has a http://www.gamesas.com/index.php?/topic/1044512-relz-fallout-script-extender-fose-v11/page__st__80__p__15548430&#entry15548430 function.

Cipscis
User avatar
Matthew Aaron Evans
 
Posts: 3361
Joined: Wed Jul 25, 2007 2:59 am

Post » Fri Jan 22, 2010 7:05 am

I'm not entirely certain that my inventory was absolutely empty - the game might add the pip-boy and glove when starting a game via http://geck.gamesas.com/index.php/CenterOnCell from the main menu - but it was certainly at least very close to empty, and emptier than I would ever expect to see the player's inventory during regular gameplay.

Cipscis


My situation is a follower whose inventory is actually maintained completely empty. Baby Deathclaw does not carry items, and he has to be checked now and then to see if he's got any - - - and if you give him CERTAIN items, special things happen.
User avatar
Marine x
 
Posts: 3327
Joined: Thu Mar 29, 2007 4:54 am

Post » Fri Jan 22, 2010 12:56 am

Oh, of course. For some reason I'd just assumed that you'd be checking the player's inventory.

If you'd like, I could run the test again using a non-player container so I can make certain that it's completely empty for one of the tests.

Cipscis
User avatar
Cool Man Sam
 
Posts: 3392
Joined: Thu May 10, 2007 1:19 pm

Post » Thu Jan 21, 2010 10:16 pm

Oh, of course. For some reason I'd just assumed that you'd be checking the player's inventory.

If you'd like, I could run the test again using a non-player container so I can make certain that it's completely empty for one of the tests.

Cipscis


Well, thinking about it - - - kinda yeah - - even having a single item in there such as a pip boy just wasn't the situation I'm hoping to find the details for. Maybe this whole thing is different if its in an NPC which is completely empty?

Right now I am kinda running this function (with huge, huge formlist involved) every 5 seconds. I guess I am curious to know if that inventory being completely empty saves the day and it's like doing next to nothing. I want to rethink this if it's actually.. something.

Maybe you could run your test against a naked NPC with no objects defined in its base object inventory (such as... a baby deathclaw! ;) . )

Edit: I SO don't get why local variables would be the slowest. huhhhh.
User avatar
krystal sowten
 
Posts: 3367
Joined: Fri Mar 09, 2007 6:25 pm


Return to Fallout: New Vegas