Re: SLOW bitmap from Stream

Tech-Archive recommends: Speed Up your PC by fixing your registry



You didn't answer any of Simon's question. How big is the image? What
format is it? Color depth? What kind of device? Processor speed? RAM?
etc. etc. etc...


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com



"Freesc" <hjd.click@xxxxxxxxx> wrote in message
news:06ce049f-ea54-42f1-926d-7f6df31055db@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mar 8, 5:10 am, Simon Hart [MVP] <srhart...@xxxxxxxxx> wrote:
Under half a second is not that out of the ordinary loading an image on a
device. How big is the image, on what device, how much RAM?

Calling the garbage collector is costing you, I'd get rid of that code if
I
were you.
--
Simon Hart
Visual Developer - Device Application Development
MVPhttp://simonrhart.blogspot.com



"Freesc" wrote:
Hi,there
i 'm writing an application about bitmap displaying.But i find it
works not very well because of the terrorable performance .

here's my code

/// <summary>
/// Get BMP according to the FrameNumber,then display
/// </summary>
/// <param name="FrameNo"></param>
/// <param name="FandR_Flag">direction</param>
/// <returns></returns>
public Bitmap createImage(int FrameNo, int FandR_Flag)
{
string xustr;
byte[] xutest;
xustr = "CAM";

//find image,cost about 1ms
xutest = ri.Fun_GetSpeData(xustr, FrameNo, FandR_Flag);

//read byte[] into memostream,cost about 1ms
MemoryStream ms = new MemoryStream(xutest, 0, xutest.Length);

//here cost 423ms to construct an bmp, what happened
here?!!!!!!!!!!!!!!!!!!!!!!!!
Bitmap bmp = new Bitmap(ms);

xutest = null;
ms.Close();
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
return bmp;
}

Any suggestion?

Thanks in advance~

Regards,

Freesc- Hide quoted text -

- Show quoted text -

Hi,Simon

Thanks for you reply~
i would remove the GC code.

i think 400ms is unbearable because this is a video solution, it must
be 4 or 5 frames per secend as we expect
and i can not find something like Bitmap.FromStream(new
memorystream(...)) in .NET Compactframe , so i can not prevent
constructing a new bitmap when a new frame comes
Any suggestion about that?I have to reduce the cost , but i can't find
an effective way....
thanks again~

Regards~


.



Relevant Pages

  • Re: SLOW bitmap from Stream
    ... Visual Developer - Device Application Development MVPhttp://simonrhart.blogspot.com ... How big is the image, on what device, how much RAM? ... public Bitmap createImage ... Bitmap bmp = new Bitmap; ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: SLOW bitmap from Stream
    ... Visual Developer - Device Application Development MVPhttp://simonrhart.blogspot.com ... How big is the image, on what device, how much RAM? ... public Bitmap createImage ... Bitmap bmp = new Bitmap; ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: SLOW bitmap from Stream
    ... How big is the image, on what device, how much RAM? ... Visual Developer - Device Application Development ... public Bitmap createImage ... each frame is an Image of 240*180 Bitmap, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: SLOW bitmap from Stream
    ... Visual Developer - Device Application Development MVP ... public Bitmap createImage ... Bitmap bmp = new Bitmap; ... each frame is an Image of 240*180 Bitmap, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: System.Drawing.Bitmap.Bitmap() Error
    ... Bitmap bmp = new Bitmap; ... there is no public parameterless constructor for the ... Bitmap, ... You are assigning the return value from the "GetImage" method of whatever ...
    (microsoft.public.dotnet.general)