{ "id": "172884", "key": "TIMOB-26742", "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": [ { "id": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-01-24T19:28:00.000+0000", "created": "2019-01-17T09:12:51.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [ { "id": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" } ], "issuelinks": [ { "id": "58109", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "174236", "key": "TIMOB-27457", "fields": { "summary": "Clarification on Titanium bootstrap files", "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": "High", "id": "2" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2020-01-23T20:18:32.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "When using SDK 8, the app launch is now extremely slow. It looks like the \"core-js\" libraries take waaay to long. It needs to be solved differently in order to be used in production apps. Any kind of logs or insight in our app can be shared with the core team.", "attachment": [], "flagged": false, "summary": "TiAPI: App launch slowed down by 2-5 seconds in SDK 8", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 1108, "state": "closed", "name": "2019 Sprint 2", "startDate": "2019-01-14T17:20:19.067Z", "endDate": "2019-01-26T17:20:00.000Z", "completeDate": "2019-01-28T17:38:11.580Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "445435", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "[~hknoechel] Do you have any specific timings?\r\n\r\nWe're not injecting polyfills into the app startup specifically yet. We're polyfilling based on \"usage\" - so if you're using features not supported by the OS's JS engine it'll inject the polyfill require into the file using it. So If your app.js is using them - or requiring files which do during startup, then yes it will have an impact on startup directly.\r\n\r\nSo it *may* be polyfill causing the issue, but it's also entirely possible it is not. The common JS code we do load on startup could be a cause, which also does polyfill based on usage so loads some. It's hard to say without specific numbers to look at here.\r\n\r\nThis PR would front-load the polyfill loading so it *does* hit all during startup: https://github.com/appcelerator/titanium_mobile/pull/10567 but may actually improve performance if the scattered requires of polyfills is slow.\r\n", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-01-17T14:55:10.000+0000", "updated": "2019-01-17T14:55:10.000+0000" }, { "id": "445436", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~cwilliams] I haven't measured it, yet since we have some more things to clear this week before, but I can share our repo with you (all modules are includes in the project, so no additional setup required except cloning). Let me know via Slack if I can help. \r\n\r\nTo clarify our situation, I am talking about the time between starting launching the app and seeing the first screen, not the compile time itself. But I think we're at the same page for that one already.\r\n\r\n*EDIT*: \r\n- Launch (SDK 8): 5.3740 seconds\r\n- Launch (SDK 7.5.x): 2.032 seconds\r\n\r\nNote: On SDK 8, this logs even continue nearly a minute (!) with hundreds or even thousands of path-loading related logs. See [this PR|https://github.com/appcelerator/titanium_mobile/pull/10572] to remove those logs.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-01-17T15:30:08.000+0000", "updated": "2019-01-17T15:41:21.000+0000" }, { "id": "445449", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "In my testing this seems to be pretty specific to iOS itself and is due to an inefficient require implementation.\r\nOn Android I believe we're properly caching things, so it takes ~217ms to load the app, whereas on iOS it took ~5.3s!\r\n\r\nI provided a very quick and dirty hack to aggressively cache requires on iOS which took that down to ~1.25s. I need to iterate on that solution, though, as it is caching too aggressively - it does not account for requires of node modules from different base paths (so using two different versions of the same module would be broken with it as the first one loaded will always then be loaded).\r\n", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-01-17T21:05:25.000+0000", "updated": "2019-01-17T21:05:25.000+0000" }, { "id": "445532", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Quick update - this is a huge performance gap between iOS and Android here. Android \"cheats\" and during build generates an index.json file with a listing of all the JS and JSON files in the app - and the require implementation uses that listing to check if a file exists. iOS actually attempts to load the file from the encrypted assets first, falls back to trying to load from disk, and **then** assumes it does not exist if both of those fail. Not great.\r\n\r\nSo I'm testing two big changes here: using a cheat index.json for require file existence checks; and modifying the require implementation to do two passes: resolve the path to a full filename, then load it. Resolving as quick as possibly without actually loading lets us cache globally by the full filename/path - so we should have better caching behavior now as well.\r\n\r\nI slapped up a PR now, but I need to clean up my commits and ensure we pass all the tests before I'd consider the PR \"ready\" for review: https://github.com/appcelerator/titanium_mobile/pull/10640", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-01-22T19:39:22.000+0000", "updated": "2019-01-22T19:39:22.000+0000" }, { "id": "445533", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "8_0_X branch: https://github.com/appcelerator/titanium_mobile/pull/10640", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-01-22T21:20:09.000+0000", "updated": "2019-01-22T21:20:09.000+0000" }, { "id": "445637", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Passed FR. Merged PR manually to 8_0_X and master branches.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-01-24T19:28:24.000+0000", "updated": "2019-01-24T19:28:24.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }