Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

memcpy faster in debug mode

This topic is 5643 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
Thanksª, I did it and I found the problem wasn''t there.

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest 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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!