[Mono-osx] GDI+ OSX performance

LKeene lionel.keene at gmail.com
Wed Aug 19 11:51:02 EDT 2009


Alex,

no the code is not being executed within a loop. The pinned array is used as
a mechanism to allow fast pixel processing while avoiding unsafe code. The
method works very well. See the article here:
http://www.howtocode.net/software-development/multimedia/fast-pointerless-image-processing-in-net

I haven't yet tried profiling. That will be the next step. However, all my
binaries are VS2008 which I am executing on the Mono runtime. What profiling
tools are available for use on Mac?

-L



Alexander Shulgin wrote:
> 
> LKeene wrote:
>> Hi Alex,
>> 
>> it's in response to an earlier thread I started wherein I was getting
>> very
>> poor performance. Someone suggested it was due to Graphics object
>> allocations being a bottleneck:
>> 
>> http://www.nabble.com/Horrible-performance-on-Mac%2C-need-advice.-td24507897.html
>> 
>> Any thoughts on the matter? I'm soon going to tackle this performance
>> issue
>> full-force and I'd very much like to get some ideas of where (in general)
>> to
>> start.
> 
> I hope you are not trying to say that the code you presented in that 
> mail[1] is executed in the tight loop.  Otherwise it's strange to expect 
> it to perform any good.
> 
> //...
> handle = GCHandle.Alloc(Channel1BitmapBytes, GCHandleType.Pinned); // 
> Pin the array.
> IntPtr channel1PTR = 
> Marshal.UnsafeAddrOfPinnedArrayElement(Channel1BitmapBytes, 0);
> Channel1Bitmap  = new Bitmap(this.CanvasWidth, this.CanvasHeight, 
> stride, myPixelFormat, channel1PTR);
> 
> // ...later on (in Paint event handler for example)...
> Graphics grafix = Graphics.FromImage(Channel1Bitmap);
> 
>  > "Channel1BitmapBytes" is a declared globally (within the context of
>  > "this") and, because the array is pinned, I can write to it in
>  > multi-threaded fashion.
> 
> I fail to see how pinning the array helps in multi-threaded access.  Do 
> you use any synchronization primitives?
> 
> Also, did you try profiling?
> 
> --
> Kind regards,
> Alex
> 
> [1] http://go-mono.com/forums/#nabble-p24577325
> 
>> Alexander Shulgin wrote:
>>> LKeene wrote:
>>>> Hello all, I'm revisiting an old issue. Has anyone seen (big)
>>>> performance
>>>> issues with Mono + OSX regarding the use of:
>>>>
>>>> Graphics grafix = Graphics.FromImage(SomeBitmap);  ?
>>> No.  Why?
>>>
>>> --
>>> Alex
> 
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
> 
> 

-- 
View this message in context: http://www.nabble.com/GDI%2B-OSX-performance-tp25011596p25046790.html
Sent from the Mono - OSX mailing list archive at Nabble.com.



More information about the Mono-osx mailing list