[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Solving slowdown issue in code ported from MFC

herc

9/12/2007 3:38:00 PM

I just had an oh S#!^ moments, a week of work on an 8 week project
might get thrown out! I *THINK* the problem is that .Net is moving my
memory on me, I am not 100% sure. Here is the deal:

I am trying to convert the GUI of a C++/MFC app to .Net 2.0. In the
core of the C++/MFC app is code that is iterating through three
images, up to about 10M or RAM, in real time! It needs to keep pace
with mouse moves! The original application (unmanaged C++) is able to
keep up, for the most part.

In the conversion I wrapped all the unmanaged classes the contained
the data in C++ CLI managed classes. I thought I kept the unmanaged
code purely unmanaged so I would not have interop calls in the core
function that iterates through the images. The compiler is honoring my
__inline requests, which improved the unmanaged code by about 15%,
but...

The core function takes around 0.6563970132 in the original MFC app,
and the exact same function in the C++ CLI module takes around 49
seconds! That is a 74x difference!

I have two guesses at the issue, there ARE interop calls in the core
function that are killing me or the memory being allocated by
CreateDIBSection() is getting moved around on me by .Net.

Does anyone have any suggestions on how I can track down where the
problem is? Does anyone know if I can get back the original speed if
I where to convert everything to managed code? I am using the data
from every byte of three images to create the fourth image.

Cartoper