Pasted images into background slow down the app?
There is a fast loop that runs 10000 times and on each loop relocates an active object(star) at a random position and then pastes to the background. Why is it that after the loop is over the app is slower? Isn't the background just one big homogenous surface where things are drawn onto? Why does the number of pasted images matter?
Re: Pasted images into background slow down the app?
Have you tried both "paste image into background" and "add backdrop" to no avail? What are you pasting them as? Obstacles, no effect on collisions, etc.? Are you sure the stars themselves are being destroyed after they are pasted into the background?
Re: Pasted images into background slow down the app?
Hey Corlen
I haven't tried "add backdrop" because that is bound to be slower. They are pasted as "no effect on collisions". There is only one star that is randomly changing position per loop so destroying one active object wouldn't make a difference.
Re: Pasted images into background slow down the app?
Make sure you destroy them after "paste image into background".
Marv
Re: Pasted images into background slow down the app?
Again, that's not the issue because there is only one active object being relocated per loop. So there's only 1 star not 10000.
Re: Pasted images into background slow down the app?
This is not what you stated in your question.
How is there only one star? After you "paste image into background" did you destroy them? If not they are still in memory as 10,000 stars, fastloop or not. How is there only one star if you are pasting 10,000 of them? Please re-ask your question.
Marv
Re: Pasted images into background slow down the app?
If I understood correctly, he means he has a fastloop going up to 10,000 times that sets this one star's position to a random location and the pastes it into the background.
Are you only running the fastloop 10,000 times and then stopping it? Did you run the fastloop 10,000 all at once? If you did, this is going to potentially freeze your application because a fastloop is like the number you specified is a number of copies of the same code running at the same time.
Re: Pasted images into background slow down the app?
Yes you are right nivram, it is my fault, the question is misleading. I have edited the original post.
Re: Pasted images into background slow down the app?
Corlen the fastloop runs 10k times at the start of frame and there a freeze but that is not the problem. The problem is that the app runs 10 frames slower with the pasted stars than without. It is weird that it matters whether there's 10k,1k or 0 pasted stars. Isn't pasting to the background supposed to be blitting onto one single surface?
Re: Pasted images into background slow down the app?
No, that's not how it works at all.
When you paste objects into the background they are still saved as individual objects - regardless of whether you use "paste in to background" or "add backdrop".
That's why you can't keep creating them indefinitely (they count towards the object total), and why it's possible to delete them individually (using "delete created backdrop at").
The only difference between adding and pasting, is that pasted backdrops are deleted when the screen scrolls, whereas added backdrops are not.
What you really need to be doing, is pasting the stars into a surface/overlay object instead.