02.10.2010, 16:27
hmm.. I just was thinking what's better?
And what's more efficent
And what's more efficent
new
g_String[128];
GetString()
{
g_String = "just returning this here folks";
return g_String;
}
_GetString()
{
new
string[128];
string = "just returning this here folks";
return string;
}
public OnGameModeInit()
{
new
t,
string[128];
for (new x; x < 10; ++x)
{
t = GetTickCount();
for (new i; i < 1000000; ++i)
{
string = GetString();
}
printf("global: %i ms", GetTickCount() - t);
t = GetTickCount();
for (new i; i < 1000000; ++i)
{
string = _GetString();
}
printf("local: %i ms", GetTickCount() - t);
}
return 1;
}
[11:43:12] global: 828 ms [11:43:14] local: 1216 ms [11:43:14] global: 770 ms [11:43:16] local: 1203 ms [11:43:16] global: 777 ms [11:43:18] local: 1243 ms [11:43:18] global: 782 ms [11:43:20] local: 1156 ms [11:43:20] global: 797 ms [11:43:22] local: 1167 ms [11:43:22] global: 738 ms [11:43:23] local: 1152 ms [11:43:24] global: 743 ms [11:43:25] local: 1160 ms [11:43:26] global: 749 ms [11:43:27] local: 1148 ms [11:43:28] global: 756 ms [11:43:29] local: 1182 ms [11:43:30] global: 758 ms [11:43:31] local: 1251 ms