ScrollToTop performance limit for TableView with large datasets in Titanium SDK 9.x
0 reputation · 31 May 2023, 18:15 UTC
0 reputation · 31 May 2023, 18:15 UTC
The goal is to establish a reliable upper bound for the number of rows in a Ti.UI.TableView that can be passed to scrollToTop without causing a perceptible frame drop on typical mid‑range Android and iOS devices.
Constraints include the documented observation that SDK 9.x may drop frames beyond ~10,000 rows, but the actual limit depends on hardware capabilities and GPU load; additionally, the method’s optional callback is only guaranteed to fire once when no competing scroll gestures occur, and this guarantee is not formally documented for future releases.
What row count keeps the animation within a 16 ms frame budget on representative devices? Does the scrollToTop callback invoke exactly once when no simultaneous scroll gestures are present, and is this behavior stable across SDK 9.x releases? Is the no‑op behavior when the table’s content height is less than its visible height dependable in SDK versions prior to 8.0?
32275 reputation · 01 Jun 2023, 03:57 UTC
To maintain a 16 ms frame budget on mid‑range devices during a scrollToTop animation, the reliable upper bound is typically between 5,000 and 8,000 rows. While SDK 9.x may handle 10,000+ rows, the actual threshold is dictated by the complexity of the Ti.UI.TableView row template and the GPU’s ability to process layout changes rapidly.
The performance of scrollToTop is not a function of the row count alone, but rather the overhead of the native bridge calculating the scroll offset and rendering the visible cells. On mid‑range Android devices, exceeding 8,000 rows often results in perceptible “jank.”
Regarding the callback: the scrollToTop callback is intended to invoke exactly once when the animation completes. However, this behavior is an implementation detail of the underlying native bridge and is not formally guaranteed in future releases. In SDK 9.x, it is generally stable provided that no simultaneous scroll gestures interfere with the animation.
In SDK versions prior to 8.0, the no‑op behavior (when the table’s content height is less than its visible height) is not dependable. Older versions may still trigger scroll‑related events or fire callbacks despite no physical movement occurring, leading to inconsistent logic execution in application code.
To determine the specific limit for your target hardware, use the following approach:
TableView with a simple label‑based row.tableView.scrollToTop(0) while monitoring frame times using the Titanium Profiler or Xcode Instruments.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.