Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / What is faster? Hide sprite or settting a new position for sprite outside screen?

Author
Message
Cybermind
16
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 30th Jul 2015 11:26
Which command is faster?

SetSpriteVisible(sprite_id,1)
SetSpritePosition(sprite_id,x,y)
DrawSprite(sprite_id)
SetSpriteVisible(sprite_id,0)

OR

SetSpritePosition(sprite_id,x,y)
DrawSprite(sprite_id)
SetSpritePosition(sprite_id,x,y)

I would think it is the last one, as it has 1 function call less, but I am not sure :-P

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
BatVink
Moderator
16
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Jul 2015 12:51 Edited at: 30th Jul 2015 12:53
Try it

Set Sync rate to 0

Do the operations 100,000 times and record the times to complete

Compare the results.

Don't forget there may be an overhead of a hidden sprite within the screen bounds.

I'm doing exactly the same in a current app, I move the sprite out of screen. My frame rate is 1200+ FPS, so I'm not too worried!

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Cybermind
16
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 10th Aug 2015 11:39
Thanks

I think it was faster to re-position it Great way to examine different methods

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...

Login to post a reply

Server time is: 2019-10-17 14:18:48
Your offset time is: 2019-10-17 14:18:48