[Date Prev][Date Next][Thread Prev][Thread Next]
- 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.. ?
> 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
> 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).
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
#pragma comment(lib, "psapi.lib")
static BOOL CmdExec(LPCTSTR cmdLine, BOOL closeHandles, HANDLE
memset(&sinfo, 0, sizeof(sinfo));
sinfo.cb = sizeof(STARTUPINFO);
sinfo.dwFlags = STARTF_USESHOWWINDOW;
sinfo.wShowWindow = SW_SHOW;
BOOL ret = CreateProcess(NULL, (LPTSTR)cmdLine, NULL, NULL, TRUE, 0,
NULL, NULL, &sinfo, &pinfo);
if (processHandle != NULL)
*processHandle = pinfo.hProcess;
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 == '"')
endPtr = _tcschr(processCommandLine + 1, '"');
// Something is whacked. :( Look for a space.
endPtr = _tcschr(processCommandLine, ' ');
endPtr = processCommandLine + processCommandLineLen;
processCommandLineLen -= endPtr - processCommandLine;
// Execute LINK.exe, but wait for it to finish.
CmdExec(endPtr, FALSE, &processHandle);
if ( GetProcessMemoryInfo( processHandle, &pmc, sizeof(pmc)) )
printf( "\tPageFaultCount: 0x%08X\n", pmc.PageFaultCount );
printf( "\tPeakWorkingSetSize: 0x%08X\n",
printf( "\tWorkingSetSize: 0x%08X\n", pmc.WorkingSetSize );
printf( "\tQuotaPeakPagedPoolUsage: 0x%08X\n",
printf( "\tQuotaPagedPoolUsage: 0x%08X\n",
printf( "\tQuotaPeakNonPagedPoolUsage: 0x%08X\n",
printf( "\tQuotaNonPagedPoolUsage: 0x%08X\n",
printf( "\tPagefileUsage: 0x%08X\n", pmc.PagefileUsage );
printf( "\tPeakPagefileUsage: 0x%08X\n",