Titanium Mobile
  1. Titanium Mobile
  2. TIMOB-10363

Android: Picker "add" method is dead slow

    Details

      Description

      The problem

      Picker's "add" method is very slow, when creating picker with 30 rows on tablet with Tegra2 processor, picker "add" method takes about 1.5 seconds to execute.

      This greatly impacts Titanium's performance when there are more pickers with more that just a few options.

      Test case

      (function() {
         
         var win = Ti.UI.createWindow({
         		backgroundColor: '#000'
         });
         
         var data = [];
         
         var start = new Date();
         
         for (var i = 0; i < 30; ++i) {
         		data[i] = Ti.UI.createPickerRow({ title: 'Row ' + i });
         }
         
          Ti.API.info('Rows: ' + (new Date() - start));
         
         var picker = Ti.UI.createPicker();
         
         start = new Date();
         
         picker.add(data);
         
         Ti.API.info('Finished: ' + (new Date() - start));
         
         win.add(picker);
         
         win.open();
         
      })();
      

      30 rows is really not big number, especially on powerful hardware. 1.5 seconds is a way too much. JS execution time (creation of array of picker's rows) is 14ms. Execution of "add" method should be similar to that value.

        Activity

        Show
        Karl Rowley added a comment - Pull request https://github.com/appcelerator/titanium_mobile/pull/3351
        Hide
        Karl Rowley added a comment -

        Notes on testing this fix for engineering and QE:

        (1) Ivan's example above consistently takes 8+ seconds to start on
        my Samsung Galaxy SII. After that the refresh of the picker is fairly
        quick (i.e. without restarting the app).

        So you'll need to make sure that the app is not running if you want
        to see the bug here.

        If app is already started, go to "Settings", then "Applications",
        select your test app and then click on "Force Stop", and then start
        the app.

        (2) With the change the app takes approx. 0.4 to 0.5 seconds to start,
        which is in line with the start time for the TableView example.

        Show
        Karl Rowley added a comment - Notes on testing this fix for engineering and QE: (1) Ivan's example above consistently takes 8+ seconds to start on my Samsung Galaxy SII. After that the refresh of the picker is fairly quick (i.e. without restarting the app). So you'll need to make sure that the app is not running if you want to see the bug here. If app is already started, go to "Settings", then "Applications", select your test app and then click on "Force Stop", and then start the app. (2) With the change the app takes approx. 0.4 to 0.5 seconds to start, which is in line with the start time for the TableView example.
        Hide
        Karl Rowley added a comment -

        Re-opening pending pull request for 3_0_X branch

        Show
        Karl Rowley added a comment - Re-opening pending pull request for 3_0_X branch
        Hide
        Karl Rowley added a comment -
        Show
        Karl Rowley added a comment - Pull request https://github.com/appcelerator/titanium_mobile/pull/3361 for 3_0_X branch
        Hide
        Natalie Huynh added a comment -

        Tested with 3.0.0.v20121204144658 on Droid 1 2.2.3

        Show
        Natalie Huynh added a comment - Tested with 3.0.0.v20121204144658 on Droid 1 2.2.3

          People

          • Assignee:
            Karl Rowley
            Reporter:
            Ivan Skugor
          • Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development