News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Profiling Gdi+

Started by jj2007, July 16, 2022, 10:33:59 AM

Previous topic - Next topic

jj2007

My animated GIF display proc uses these 16 GdiPlus calls. Guess which one is the slowest... it's not intuitive. If somebody guesses right, I will reveal the surprising results of my profiling :cool:

GdipCreateBitmapFromHBITMAP
GdipCreateBitmapFromStream
GdipCreateBitmapFromHBITMAP
GdipCreateHBITMAPFromBitmap
GdipCreateFromHDC
GdipImageGetFrameDimensionsList
GdipImageGetFrameCount
GdipImageSelectActiveFrame
GdipGetPropertyItemSize
GdipGetPropertyItem
GdipGetImageWidth
GdipGetImageHeight
GdipImageRotateFlip
GdipDrawImageRectI
GdipDisposeImage
GdipDeleteGraphics


Hint: most of them cost almost no time, and two account for over 90% of the time. The slowest one is almost three times as slow as the second slowest one :cool:

# ------- units slot code ----------
2212          2    9 loading
2158        733   13 worst offender
2212        168   16 second worst offender
2212         10   19 Dispose+Delete

NoCforMe

OK, I'll play: intuitively, I'd say GdipCreateBitmapFromStream() and GdipImageRotateFlip() should be the slowest. But they're not, right? (The former because it has to read and decode a bitmap from some data source, the latter because it has to do some transformations on the image.)
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on July 16, 2022, 11:55:19 AM
OK, I'll play: intuitively, I'd say GdipCreateBitmapFromStream() and GdipImageRotateFlip() should be the slowest. But they're not, right? (The former because it has to read and decode a bitmap from some data source, the latter because it has to do some transformations on the image.)

That's probably what I would have chosen intuitively, too. Nope, they both account for under 1% of the job :cool:

OK, I'll reveal the second slowest:

GdipDrawImageRectI (that's the one that puts the pixels on the screen, so right, that is a lot of work...)