Jump to content

  • Log In with Google      Sign In   
  • Create Account

C# - store a "reference" of an object : performance killer?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Synthesizer   Members   -  Reputation: 187

Like
0Likes
Like

Posted 01 July 2012 - 05:56 PM

Hi,

I've been programming in C# for a long time & one thing I'd love to have there (optionally) are pointers.

I've been developing a game project for several years, & I usually declare attributes in my classes in order to store other handy objects.
For example, I've created a custom ModelMesh in which I store it's parent (container) Model:

class ExtendedModelMesh()
{
-Model theModelWhoContainsMe;
}

I do this for example to be able to access easy & quickly to the model's position, rotation, scale attributes & some other things.


My question is: Is it a performance killer? (in this particular case I store the same model along all it's meshes (imagine 150 meshes per model).
Is it not only eating a lot of memory but also slowing down things when fetching up the model?

Thanks a lot,

Synth

Sponsor:

#2 ApochPiQ   Moderators   -  Reputation: 15757

Like
0Likes
Like

Posted 01 July 2012 - 06:09 PM

In C#, your object is stored by reference. This is effectively the same as storing by pointer, in an abstract sense.

#3 Synthesizer   Members   -  Reputation: 187

Like
0Likes
Like

Posted 01 July 2012 - 06:15 PM

Good to know that!
Thanks a lot, that was an ultrasonic speed answer!! Posted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS