Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Does removing objects slow performance?
Started by nosoyhackercodigo May 30 2019 09:52 AM

1 reply to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

nosoyhackercodigo

[GLOBAL: userInfoPane.html]
nosoyhackercodigo
  • Enthusiast

  • 68 posts
  • Corona SDK

local object = display.newCircle( 128, 128, 64 )

local object2 = display.newCircle( 32, 128, 64 )

...

 

--Too many objects later...

 

object:removeSelf()

object = nil

 

object2:removeSelf()

object2 = nil

 

object...

 

How does perform code removing too many objects?



[TOPIC: post.html]
#2

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,810 posts
  • Corona SDK

Not really. Certainly, it will be a lot better for performance than just keeping the objects around doing nothing, set to invisible or off-screen. But if you can re-use objects using pooling to prevent too many create/destroy events that's even better.




[topic_controls]
[/topic_controls]