pdiddles03 Posted September 19, 2015 Share Posted September 19, 2015 Is it OK to splice an array with a pixi object in it to get rid of it? Or should I use .destroy? Which one is better for performance? Quote Link to comment Share on other sites More sharing options...
xerver Posted September 19, 2015 Share Posted September 19, 2015 If you want to get rid of the object, never to be used again, you must do both. You must lose your references so the GC can cleanup and call destroy so pixi can cleanup internally. Quote Link to comment Share on other sites More sharing options...
pdiddles03 Posted September 19, 2015 Author Share Posted September 19, 2015 I'm putting objects in an array for pooling. Of splicing the array does nothing what is the point of pooling? Quote Link to comment Share on other sites More sharing options...
pdiddles03 Posted September 19, 2015 Author Share Posted September 19, 2015 Because your still creating and destroying objects Quote Link to comment Share on other sites More sharing options...
xerver Posted September 19, 2015 Share Posted September 19, 2015 If you are calling destroy on an object it is because you are done with an object, done in such a way that it will never be used again. If you are pooling what you do is when you are done with an object you add it to the pool, and when you need an object you grab it from the pool. You don't destroy it because it will be used again at some point. If you are pooling, you shouldn't be destroying objects. Quote Link to comment Share on other sites More sharing options...
pdiddles03 Posted September 20, 2015 Author Share Posted September 20, 2015 Ok so I am using shift and unshift to remove and add objects back to the pool. Sometimes I put the pool object into another array, why would you suggest is the best solution to remove that from the new array and put back into the pool array? My problem is I don't want to create another array because some of the methods do. Quote Link to comment Share on other sites More sharing options...
xerver Posted September 27, 2015 Share Posted September 27, 2015 This is very abstract, I'm not sure what you are trying to do or what you're asking for. Would you mind sharing a concrete example of what you are trying to do? Like a running code example you are trying to optimize or something? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.