Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23637] Windows: Titanium object creation takes too long

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-07-21T13:25:32.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sRelease 6.0.0
ComponentsWindows
Labelsn/a
ReporterKota Iguchi
AssigneeKota Iguchi
Created2016-07-14T12:01:41.000+0000
Updated2016-10-20T15:46:18.000+0000

Description

I recently found that one the performance bottleneck of Titanium Windows is occurs during object creation (Ti.createXXX etc). On my Lumia 630 I observed it takes almost 1 second to create 100 proxy object, and it can be serious issue especially on app startup because Windows Phone tend to kill the app when app startup takes too long. *Sample code*
var start = +new Date();
for (var i = 0; i < 100; i++) {
    var obj = Ti.createBuffer({length: 2});
}
alert((+new Date() - start) + ' msec');
var start = +new Date();
for (var i = 0; i < 100; i++) {
    var obj = Ti.UI.createLabel({text:'test ' + i});
}
alert((+new Date() - start) + ' msec');

Comments

  1. Kota Iguchi 2016-07-20

    https://github.com/appcelerator/titanium_mobile_windows/pull/779 We have observed this saves over 70% of time. - Ti SDK 6.0.0.v20160714010528 ... 5.5 sec - Ti SDK 6.0.0.v20160714010528 with this update ... 1.7 sec
       var win = Ti.UI.createWindow({ backgroundColor: 'green' });
       var data = [];
       
       var start = +new Date();
       for (var i = 0; i < 100; i++) {
           var task = {
               Id: i,
               Title: 'Row ' + i,
               Data: 'Data ' + i
           };
           var tvr = Ti.UI.createTableViewRow({
               height: 70,
               taskId: task.Id
           });
           tvr.add(Ti.UI.createLabel({
               text: task.Title,
               color: "#000",
               top: 5,
               left: 20
           }));
           tvr.add(Ti.UI.createLabel({
               text: task.Data,
               color: "#000",
               top: 30,
               left: 20,
               font: {
                   fontSize: 12
               }
           }));
           data.push(tvr);
       }
       
       var table = Ti.UI.createTableView({data: data});
       
       table.addEventListener('click', function (e) {
           alert(e.row.taskId)
       });
       
       alert('Total: ' + (+new Date() - start));
       
       win.add(table);
       win.open();
       
  2. Ewan Harris 2016-10-20

    Verified using: OS: Microsoft Windows 10 Pro 10.0.14393 Appc core: 6.0.0-62 Appc NPM: 4.2.8-9 Ti SDK: 6.0.0.v20161019091022 Appc Studio: 4.8.0.201610171310 Lumia 550 10.0 Lumia 520 8.1 Performance of titanium object creation has been improved Closing ticket

JSON Source