{ "id": "113514", "key": "TIMOB-13712", "fields": { "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "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": [ { "id": "15418", "description": "2013 Sprint 09 API", "name": "2013 Sprint 09 API", "archived": true, "released": true, "releaseDate": "2013-05-06" }, { "id": "15107", "description": "2013 Sprint 09", "name": "2013 Sprint 09", "archived": true, "released": true, "releaseDate": "2013-05-06" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-05-06T22:45:57.000+0000", "created": "2013-04-29T18:48:23.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "experiment", "performance" ], "versions": [ { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" } ], "issuelinks": [ { "id": "28205", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "113198", "key": "TIMOB-13644", "fields": { "summary": "Platform Performance Improvements", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "6", "description": "gh.issue.epic.desc", "name": "Epic", "subtask": false } } } } ], "assignee": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-22T00:08:49.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": "1. Design an experiment to measure the validity of the hypothesis \"The event subsystem is slow because it performs calculations even when there are no event listeners\".\r\n\r\n2. Run the experiment and collect the data.\r\n\r\n3. Analyze the data.\r\n\r\n4. Create a short writeup presenting results and conclusions.\r\n", "attachment": [], "flagged": false, "summary": "Android: Experiment: The event subsystem is slow because it performs calculations even when there are no event listeners", "creator": { "name": "mlangston", "key": "mlangston", "displayName": "Matt Langston", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mlangston", "key": "mlangston", "displayName": "Matt Langston", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "249480", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "h4.The hypothesis : The event subsystem is slow because it performs calculations even when there are no event listeners.\r\n\r\n---------------------\r\n\r\nh4.Experiment to test out the hypothesis.\r\n\r\n* Log the amount of time required/data creation cost to fire events through dofireEvent method in KrollObject.java. Changes can be viewed [here|https://github.com/srahim/titanium_mobile/compare/timob-13712].\r\n* Initial test was conducted with a sample app containing a window and button. [CODE|https://gist.github.com/srahim/5485115].\r\n* Results of the test [log1|http://tinyurl.com/bw73vn4], [log2|http://db.tt/HS1XyFIa], [log3|http://db.tt/9wOAu59E].\r\n* Initial Analysis of the logs shows that our system fires a lot of unnecessary events even though nobody is listening for it. But the cost associated with it (forming the actual event and its related data) seems negligible(less than 0ms in most cases).\r\n* Repeated the same test with a bit more complex app [Matt's touch test app |http://db.tt/1wB3sDCL].\r\n* Results of the test [log1|http://db.tt/OwNh0P49], [log2|http://db.tt/QRJKmNfL], [log3|http://db.tt/izkBe4Ro], [log4|http://db.tt/USy46eav].\r\n* Logs showed the same observation as we made before. We do fire a lot of unnecessary events when there are no listeners.\r\n* Repeated the test with TableViews in KS. Results [log1|http://db.tt/I30KD5QC], [log2|http://db.tt/SZQM84h9], [log3|http://db.tt/pUzkCMig].\r\n* KS also shows the same results for scroll events. We generate a lot of scroll events when not required.\r\n\r\n---------------------\r\n\r\nh4.Conclusions\r\n\r\n* The excess processing of unwanted events does not result in any perceivable app performance hit. \r\n* It might be worth noting that in bigger apps where each window might contain numerous child views, this could result in the event queue getting filled up and actual events that the user is listening for could be delayed. \r\n* Even though each individual event does not cost much to process, as whole this could lead to a small delay(1 - 250ms depending on the complexity of the app) in the app.\r\n\r\n---------------------\r\n\r\nh4.Recommendations\r\n\r\n* We should always check if the current event being processed has any listeners and the listening proxy should be the first one to be notified instead of going through the hierarchy of child to parent.\r\n* Even though this would result in cleaning up the code flow and event queue significantly, this fix might not show any significant app performance improvement. \r\n", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-29T23:04:48.000+0000", "updated": "2013-04-29T23:14:25.000+0000" }, { "id": "414689", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T00:08:49.000+0000", "updated": "2017-03-22T00:08:49.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }