Author Topic: UIDragScrollView.OnDisable() perf question  (Read 2292 times)

Zyxil

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 37
    • View Profile
UIDragScrollView.OnDisable() perf question
« on: July 23, 2017, 08:37:06 PM »
Is this OnDisable() even necessary to have?  It allocs a bunch of junk for the GC to clean up.  With a very large number of elements, I'm seeing 80+ % in 2 second frames when destroying and recreating lists.  :(

Zyxil

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 37
    • View Profile
Re: UIDragScrollView.OnDisable() perf question
« Reply #1 on: July 23, 2017, 09:06:38 PM »
Here is a Profiler view.  Don't worry about the 40s time, this is a Deep Profile.

This was a 400 element list in a scrollview and it alloc'd 453mb, over 255mb worth in CalcRelativeWidgetBounds().   :D

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDragScrollView.OnDisable() perf question
« Reply #2 on: July 24, 2017, 08:02:06 PM »
Curious... How about we add a "if (mPressed == pressed) return;" check to the very top of UIScrollView.Press?

Zyxil

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 37
    • View Profile
Re: UIDragScrollView.OnDisable() perf question
« Reply #3 on: July 24, 2017, 08:25:11 PM »
That relieves the massive alloc from DestroyChildren() down to 0b. It's still a time sink (about 40% of total fame time), which is reasonable as (in this case) I'm destroying 553 compound widgets.

Of course, I'm not going to allow this many items in the list during normal operations. I was testing to find the sweet spot when I noticed the memory consumption.

Will you be making this change to the codebase?  If so, I'll just leave this tweak in and forget about it and the next upgrade will magically cause no issues.   :D

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDragScrollView.OnDisable() perf question
« Reply #4 on: August 03, 2017, 03:32:25 AM »
Yup, I've made the change locally so it will be like that in the next update. Thanks for confirming.