{ "id": "89885", "key": "TIMOB-8699", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "10100", "description": "This issue won't be actioned.", "name": "Won't Do" }, "resolutiondate": "2020-01-10T18:05:13.000+0000", "created": "2012-04-12T02:55:17.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "api" ], "versions": [ { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" } ], "issuelinks": [], "assignee": null, "updated": "2020-01-10T18:05:13.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h2. The problem\r\n\r\n\r\n\r\nTableView's \"appendRow\" method seems to be very slow when rows are appended one by one. Performance issue does not exists if that method is called on array of rows.\r\n\r\n\r\n\r\n\r\nh2. Steps to reproduce this issue\r\n\r\n\r\n\r\n\r\nRun this example:\r\n\r\n{code}\r\nvar win1 = Titanium.UI.createWindow({\r\n title:'Form Test',\r\n navBarHidden: true,\r\n backgroundColor:'#eee'\r\n});\r\n\r\nvar tableView = Ti.UI.createTableView({\r\n \r\n});\r\n\r\nvar rows = [];\r\n\r\nvar start = new Date();\r\n\r\nfor (var i = 0; i < 100; ++i) {\r\n \r\n var row = Ti.UI.createTableViewRow({ title: 'Row ' + i, className: 'Row' });\r\n \r\n tableView.appendRow(row);\r\n}\r\n\r\nTi.API.info(new Date() - start);\r\n\r\nwin1.add(tableView);\r\n\r\nwin1.open();\r\n{code}\r\n\r\nAnd see the output. On a device that I'm testing on, I'm getting around 5000ms.\r\n\r\n\r\n\r\n\r\nh2. Expected behavior\r\n\r\n\r\n\r\n\r\n\r\nAbove example really should not run that long. 100 rows is not that big number and 5 seconds is just too slow. If array of rows is used, then performance is much better (same as using \"setData\") as can be seen in this test case:\r\n\r\n{code}\r\nvar win1 = Titanium.UI.createWindow({\r\n title:'Form Test',\r\n navBarHidden: true,\r\n backgroundColor:'#eee'\r\n});\r\n\r\nvar tableView = Ti.UI.createTableView({\r\n \r\n});\r\n\r\nvar rows = [];\r\n\r\nvar start = new Date();\r\n\r\nfor (var i = 0; i < 100; ++i) {\r\n \r\n var row = Ti.UI.createTableViewRow({ title: 'Row ' + i, className: 'Row' });\r\n \r\n rows.push(row);\r\n \r\n}\r\n\r\ntableView.appendRow(rows);\r\n\r\nTi.API.info(new Date() - start);\r\n\r\nwin1.add(tableView);\r\n\r\nwin1.open();\r\n{code}\r\n\r\n\r\nIn this case, test completes in about 200ms and is similar to \"setData\" performance.\r\n\r\n\r\nIn my opinion, performances in both cases should be similar.", "attachment": [], "flagged": false, "summary": "Android: TableView \"appendRow\" function is slow when called for each row", "creator": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "* Titanium SDK version: 2.1.0 (04/11/12 15:44 38b8e41)\r\n* v8\r\n* Android 3.1\r\n* Lenovo Thinkpad Tablet\r\n* Windows Xp", "comment": { "comments": [ { "id": "191756", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Hello.\r\n\r\n\r\nI see that this ticket was mentioned in the Wiki: https://wiki.appcelerator.org/display/guides/TableViews\r\n\r\n\r\n\r\nTo explain why did I make this ticket. No one normal will append 100 rows. And if 100 rows needs to be appended to the table view, an array of rows can be created first and then passed to \"appendRow\" function.\r\n\r\n\r\n\r\nI'm not trying to say I am not normal :D 100 rows is big enough number to see the performance drop clearly and \"appendRow\", as its name says, accepts one row. Support for array of rows was added recently. Anyway, this function is extremely useful when building native JS wrapper for TableView component. Wrapper for TableView is tricky to implement and \"appendRow\" makes that task very easy to do. That's why performance of this function is important when it's called as I described.\r\n\r\n\r\nThis can be set \"low\" priority because there are only few devs that are trying to build native wrappers around Titanium components (Kevin and me, and there was few others but they are not active any more) and there are even fewer devs that are trying to wrap TableView. No matter that, I would like to see this ticket resolved because I think that native-like behavior of JS host objects is awesome in any JS environment and in Titanium especially (and resolving this ticket would help that purpose).", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-04-19T01:55:14.000+0000", "updated": "2012-04-19T01:55:14.000+0000" }, { "id": "242877", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "body": "When using append row it takes more time to launch the app, but if we use the second sample code it works faster.\n\n\nIssue reproduces \n\nTested with\n\nTitanium Studio, build: 3.0.1.201212181159\nTitanium SDK version: 3.1.0 (03/11/13 15:43 0c88429)\nTitanium SDK version: 3.0.2 (02/07/13 16:46 a4def81)\nDevice: Samsung galaxy s duos Android version: 4.0.4\n\njithinpv\n\n", "updateAuthor": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-19T10:23:22.000+0000", "updated": "2013-03-19T10:23:22.000+0000" }, { "id": "453648", "author": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. \r\n\r\nIf community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.", "updateAuthor": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-01-10T18:05:13.000+0000", "updated": "2020-01-10T18:05:13.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }