[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: GC performance
- From: "Joshua Jensen" <jjensen@...>
- Date: Thu, 6 Jan 2005 23:35:42 -0700
> > I get the following on an Athlon 64 3200+ running Windows XP:
>
> Wow .. some of your numbers are very different from mine (I'm
> using 700MHz PIII :)
And I should add that I compiled with Visual C++ 7.1 in the default Release
build. I'd be happy, BTW, to post the three executables I created if
anybody wants to verify (or just grab luarc from Subversion and download the
standard Lua 5.0.2 and 5.1 work4 builds.
> 3 times slower.. ?
Yep.
> Now almost 5 times slower and 50% more memory..
Yep. A little surprising, but it kind of fits Mike Pall's graph.
> However, if you call collectgarbage() at the end of the test
> and include that in the times, it may be fairer:
> in theory, the incremental collector should have already
> cleaned up some garbage and so a final full collection should
> be faster in work4 than 5.0.
Ironically, the peak working set size grows when collectgarbage() is run in
work4.
> I.e. one hopes to get say 10% slowdown in running code, and
> 50% speed up on full collection with 10 times less full
> collections needed so it all balances out to a small overhead
> to get rid of the 'world stop' behaviour which isn't so great
> in RT applications like games.
Sure. I make games for a living. I have high hopes for Lua 5.1 working.
I'm sure it can. But in the meantime, luarc has the best behavior out of
the three versions whenever collection is occurring (without collection,
it's slower than Lua 5.0.2).
Josh
----------
Here is the application I used to get more exact numbers than watching the
Task Manager. When the Task Manager in Windows sampled at the right time,
numbers came pretty near the working set size, and those are the numbers I
posted above. If anybody has a better technique on Windows, just say so,
and I'll repost my numbers.
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from
Windows headers
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <assert.h>
#include <crtdbg.h>
#include <windows.h>
#include <psapi.h>
#pragma comment(lib, "psapi.lib")
static BOOL CmdExec(LPCTSTR cmdLine, BOOL closeHandles, HANDLE
*processHandle)
{
STARTUPINFO sinfo;
memset(&sinfo, 0, sizeof(sinfo));
sinfo.cb = sizeof(STARTUPINFO);
sinfo.dwFlags = STARTF_USESHOWWINDOW;
sinfo.wShowWindow = SW_SHOW;
PROCESS_INFORMATION pinfo;
BOOL ret = CreateProcess(NULL, (LPTSTR)cmdLine, NULL, NULL, TRUE, 0,
NULL, NULL, &sinfo, &pinfo);
if (closeHandles)
{
CloseHandle(pinfo.hProcess);
}
if (processHandle != NULL)
*processHandle = pinfo.hProcess;
CloseHandle(pinfo.hThread);
return ret;
}
int _tmain(int argc, _TCHAR* argv[])
{
// For now, print the command line so we can see what is going on.
TCHAR* processCommandLine = GetCommandLine();
// Remove the executable name from the process command line.
size_t processCommandLineLen = _tcslen(processCommandLine);
TCHAR* endPtr = NULL;
if (processCommandLine[0] == '"')
{
endPtr = _tcschr(processCommandLine + 1, '"');
if (!endPtr)
{
// Something is whacked. :( Look for a space.
}
else
{
endPtr++;
}
}
if (!endPtr)
{
endPtr = _tcschr(processCommandLine, ' ');
}
endPtr++;
if (!endPtr)
endPtr = processCommandLine + processCommandLineLen;
processCommandLineLen -= endPtr - processCommandLine;
// Execute LINK.exe, but wait for it to finish.
HANDLE processHandle;
CmdExec(endPtr, FALSE, &processHandle);
WaitForSingleObject(processHandle, INFINITE);
PROCESS_MEMORY_COUNTERS pmc;
if ( GetProcessMemoryInfo( processHandle, &pmc, sizeof(pmc)) )
{
printf( "\tPageFaultCount: 0x%08X\n", pmc.PageFaultCount );
printf( "\tPeakWorkingSetSize: 0x%08X\n",
pmc.PeakWorkingSetSize );
printf( "\tWorkingSetSize: 0x%08X\n", pmc.WorkingSetSize );
printf( "\tQuotaPeakPagedPoolUsage: 0x%08X\n",
pmc.QuotaPeakPagedPoolUsage );
printf( "\tQuotaPagedPoolUsage: 0x%08X\n",
pmc.QuotaPagedPoolUsage );
printf( "\tQuotaPeakNonPagedPoolUsage: 0x%08X\n",
pmc.QuotaPeakNonPagedPoolUsage );
printf( "\tQuotaNonPagedPoolUsage: 0x%08X\n",
pmc.QuotaNonPagedPoolUsage );
printf( "\tPagefileUsage: 0x%08X\n", pmc.PagefileUsage );
printf( "\tPeakPagefileUsage: 0x%08X\n",
pmc.PeakPagefileUsage );
}
CloseHandle(processHandle);
return 0;
}