memcpy faster in debug mode
MSVC++ 6.0
I''m using memcpy() to copy 600kb of data from system memory to system memory. I do this once every frame in my "game".
When I compile and run the program in Debug mode it runs faster than in Release mode. (I can see a slow down in the frames per second counter, like 20%)
Anybody knows why?
Thanksª, I did it and I found the problem wasn''t there.
The problem is here:
I Lock a DDRAW surface and then I do a memcpy from System Memory to Video Memory. This are the timings:
Debug Mode : 4 milliseconds
Release Mode : 6 milliseconds.
I don''t know why this happens. Can you see something wrong here?
The problem is here:
if(m_lpDDSLockable->Lock(NULL, &m_ddsdBack, DDLOCK_WAIT, NULL) == DD_OK) { m_wPdds = (WORD *) m_ddsdBack.lpSurface; memcpy((void*)(m_wPdds),(const void*)(m_GfxData.pData),m_GfxData.Size); } m_lpDDSLockable->Unlock(NULL);
I Lock a DDRAW surface and then I do a memcpy from System Memory to Video Memory. This are the timings:
Debug Mode : 4 milliseconds
Release Mode : 6 milliseconds.
I don''t know why this happens. Can you see something wrong here?
This is shot in the dark, but maybe you have different optimization options set for the debug and release profiles.
quote:Original post by petewood
This is shot in the dark, but maybe you have different optimization options set for the debug and release profiles.
Oh, I wish. I''m using the default options. There isn''t too much to touch in the compiler window. I tried activating and deactivating some stuff but the problem remains.
quote:Original post by petewood
yes, 0.004 and 0.006 are very small numbers.
do some bigger tests
The difference of 2ms becomes 20% less frames in one second. The most incredible thing is that Debug mode is faster than Release mode. I''m sure the problem arises when I do a memcpy() from system to video memory. I think I should desist trying to do it and just work with video memory.
You stated exactly why this is happening; you are coppying from system memory to video memory. If I recall correctly, in Debug mode, DDraw puts ALL surfaces in system memory, so your memcpy is faster (system memory to system memory).
quote:Original post by Anonymous Poster
You stated exactly why this is happening; you are coppying from system memory to video memory. If I recall correctly, in Debug mode, DDraw puts ALL surfaces in system memory, so your memcpy is faster (system memory to system memory).
Mmmm, I don''t think so. When I look the free video mem after creating every surface I see the video mem going down, so I belive the surfaces are being created in video mem.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement