Jump to content


Photo

1 Instance Or Many


  • Please log in to reply
3 replies to this topic

#1 verzigua

verzigua

    GMC Member

  • New Member
  • 257 posts

Posted 27 January 2010 - 03:20 PM

Well is it faster to have 1 instance using "with (objects)", or having each object performing? or is it the same performance wise?

this regarding just 1 step, a 1 time thing.

example:

obj_controller code: with (obj_block) motion_set(dir,speed);


or

obj_block user0 event: motion_set(dir,speed);

imagine there is 1 obj_controller and 500 obj_block

(that is just an example it's not something i'm doing)
  • 0

#2 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16823 posts
  • Version:GM:Studio

Posted 27 January 2010 - 03:30 PM

I posted in another topic about how Yourself´s High Resolution Timer can be of use for benchmarking code and this is another situation where you could try and find out for yourself by testing what you propose...

I suspect that each object with the code will be (ever so, ever so, slightly!) faster, but really the two will probably work out more or less the same as the overhead of calling the code from an another object will be negligble. The real reason for doing it one way or the other is comfort and ease of use for you personally...
  • 0

#3 verzigua

verzigua

    GMC Member

  • New Member
  • 257 posts

Posted 27 January 2010 - 03:38 PM

oh.. i read your thing bout that earlier.. didn't even ocurred to me.. :ph34r:

anyway i'm not confortable with dll's on game maker as i've never used any. so i'm skipping that. i was affraid that with (objects) 500 times to perform on the same step the game could get slower, by your answer i can see that's not the case.

thanks for the help.
  • 0

#4 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16823 posts
  • Version:GM:Studio

Posted 27 January 2010 - 04:17 PM

I was sceptical of DLLs at first too, but have since found that they are an invaluable resource (where would I be without my Supersound dll?)... As for the code, think of it this way, each step 500 objects have to run the code, No? Then what difference does it make in which of the 500 objects the code is written? None... The only difference is that the "with" will have be 1/10000000000000 times slower (maybe!)... I can live with that if it makes the programming easier to change/read/fix etc...
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users