Re: 3D Points (structs vs classes)
From: Eric Gunnerson [MS] (ericgu_at_online.microsoft.com)
Date: 02/27/04
- Next message: Sean Wolfe: "Thread mysteriously terminates."
- Previous message: Jerry Pisk: "Re: ASP .NET poor performance. Memory going unused??"
- Maybe in reply to: Robert Jacobson: "Re: 3D Points (structs vs classes)"
- Next in thread: Lord Crc: "Re: 3D Points (structs vs classes)"
- Reply: Lord Crc: "Re: 3D Points (structs vs classes)"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 26 Feb 2004 16:59:06 -0800
To echo what Frank said, the 16 byte part is a guideline.
The tradeoff is between the time taken in your type be a reference type (ie
allocation and GC overhead and overall memory pressure) vs the time it takes
to copy the struct as parameters and return types, and any boxing overhead.
The tradeoff is going to be different depending on how you use your type, so
it's something you need to measure. My guess is that a 3D point will be
faster as a struct, especially if you have a ton of them.
-- Eric Gunnerson Visit the C# product team at http://www.csharp.net Eric's blog is at http://weblogs.asp.net/ericgu/ This posting is provided "AS IS" with no warranties, and confers no rights. "Frank Hileman" <frankhil@no.spamming.prodigesoftware.com> wrote in message news:%23UkmeVx8DHA.452@TK2MSFTNGP11.phx.gbl... > Hello cody, > > We used structs instead of classes for a 3x2 float matrix. We found the > struct much faster, especially since they have operator overloading and > produce a lot of temp objects in complex expressions. They are a natural fit > for matrices, vectors, and points. > > In fact I think you could go even higher in size and see a speed improvement > for that type of abstraction. > > Regards, > Frank Hileman > Prodige Software Corporation > > check out VG.net: www.vgdotnet.com > Animated vector graphics system > Integrated VS.net graphics editor > >
- Next message: Sean Wolfe: "Thread mysteriously terminates."
- Previous message: Jerry Pisk: "Re: ASP .NET poor performance. Memory going unused??"
- Maybe in reply to: Robert Jacobson: "Re: 3D Points (structs vs classes)"
- Next in thread: Lord Crc: "Re: 3D Points (structs vs classes)"
- Reply: Lord Crc: "Re: 3D Points (structs vs classes)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|