[Gtk-sharp-list] [PATCH] Extra allocations in Gtk# structs

Mike Kestner mkestner@speakeasy.net
Tue, 20 Jan 2004 10:49:45 -0600


On Sun, 2004-01-11 at 19:24, Ben Maurer wrote:

> (<mytype>) Marshal.PtrToStructure (raw, self.GetType ());
> 
> However, this is slow, because the Marshal method ends up allocating a
> boxed value type. So, I changed the generator to emit:
> 
> return *(<mytype>*) raw;
> 
> This is much faster, as it is just an indirection + copy. I tested
> monodoc and MD after the change, they work fine.

Forgot I hadn't responded to this.  I can't imagine this is a correct
change to make in general.  If you want to talk about the specific
performance issue you guys are seeing, maybe we can come up with a
better solution?

-- 
Mike Kestner <mkestner@speakeasy.net>