Re: 32-bit programs on Windows x64
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 03 Jul 2008 22:20:18 -0400
Here's an example
static const UINT MEGABYTE = 1024 * 1024;
static int counters[1 * MEGABYTE];
void CFourGBDlg::OnBnClickedGo()
{
LARGE_INTEGER start;
LARGE_INTEGER end;
::QueryPerformanceCounter(&start);
for(LONGLONG i = 65536; i < (LONGLONG)1024 * (LONGLONG)1024 * (LONGLONG)1024 *
(LONGLONG)4; i++)
{ /* scan data */
counters[i & 0xFFFFF]++;
} /* scan data */
::QueryPerformanceCounter(&end);
LARGE_INTEGER freq;
::QueryPerformanceFrequency(&freq);
double delta = ((double)end.QuadPart - (double)start.QuadPart) /
(double)freq.QuadPart;
CString s;
s.Format(_T("%.17f"), delta);
c_Result.SetWindowText(s);
}
The result is the loop takes 271 seconds, which is a lot longer than 100ms. Therefore, it
is essential to ask "How do I access 4GB of data efficiently?"
As I tell my students, "Code size is completely irrelevant; data will kill you". If you
have a requirement to respond in 100ms, worrying about physical memory is among the least
of your problems. There is a MASSIVE design issue about how to organize the data to
maintain a small working set. You can't solve a bad algorithm by trying to weak the
physical memory size. If this is the solution, then you need to rethink the problem,
because you are relying on parameters that are not really under your control.
joe
****
On Thu, 3 Jul 2008 14:03:01 -0700 (PDT), PeteOlcott <PeteOlcott@xxxxxxxxx> wrote:
Joseph M. Newcomer [MVP]What part of "virtual memory is not physical memory" are you missing. I've said this
eight or ten or a dozen times, VIRTUAL MEMORY IS NOT PHYSICAL MEMORY.
Not only does my process require 4.0 GB of RAM, it is also time
critical. If there is any swapping to and from VM, then the current
project becomes infeasible. I must know how much actual RAM is
available to my process, even though this actual RAM will be mapped to
VM. If three is any swapping to and from disk, the current project
becomes infeasible, my maximum response time is 1/10 second.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- 32-bit programs on Windows x64
- From: Peter Olcott
- Re: 32-bit programs on Windows x64
- From: Campy Happer
- Re: 32-bit programs on Windows x64
- From: PeteOlcott
- Re: 32-bit programs on Windows x64
- From: Joseph M . Newcomer
- Re: 32-bit programs on Windows x64
- From: PeteOlcott
- 32-bit programs on Windows x64
- Prev by Date: Re: Lunch the application after login page and before desktop !!!
- Next by Date: Re: 32-bit programs on Windows x64
- Previous by thread: Re: 32-bit programs on Windows x64
- Next by thread: Dynamically create splitter window
- Index(es):
Relevant Pages
|
Loading