Author Topic: Would pooling be a best practice for handling labels in scrollviews?  (Read 3746 times)

DuaneDog

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
When I'm populating my scrollviews, right now I'm destroying all of them and then loading then reinitializing them to repopulate the scrollview. Once the list gets more than about 50 items you can actually see the performance hit. I'm curious if a better practice would be to use some kind of pooling so that at least after the first time they are made rather than creating and destroying them over and over they are reused?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Would pooling be a best practice for handling labels in scrollviews?
« Reply #1 on: March 05, 2014, 07:36:44 AM »
Sure, if you disable them instead of destroying them, you can unparent them and keep them in some kind of a cache.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Would pooling be a best practice for handling labels in scrollviews?
« Reply #2 on: March 05, 2014, 01:59:07 PM »
Caching and pooling is generally always a better option, since intantiate is hardly free. It's just a bit of work, so if it's not needed, people tend to not do it.