{ "id": "173211", "key": "TIMOB-26909", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": "20412", "name": "Release 8.1.0", "archived": false, "released": true, "releaseDate": "2019-08-13" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-04-12T14:21:26.000+0000", "created": "2019-03-18T22:17:02.000+0000", "epic": { "id": 173208, "key": "TIMOB-26906", "name": "", "summary": "Performance improvements during 2019", "color": { "key": "color_1" }, "done": false }, "priority": { "name": "None", "id": "6" }, "labels": [ "android", "performance", "v8" ], "versions": [], "issuelinks": [ { "id": "57473", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "outwardIssue": { "id": "173421", "key": "TIMOB-26957", "fields": { "summary": "Android: Update V8 runtime to 7.3.492.26", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } }, { "id": "57265", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "169058", "key": "TIMOB-25041", "fields": { "summary": "Add support for V8 custom startup snapshot", "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" } }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } }, { "id": "58104", "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 } } } }, { "id": "57689", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "172087", "key": "TIMOB-26316", "fields": { "summary": "Android: Investigate boot time", "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" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-01-23T20:09:33.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": "*Summary:*\r\nDuring an app cold start, Titanium will create a V8 {{Isolate}} one time for the lifetime of the app to be used as the JavaScript runtime. The C++ function call {{v8::Isolate::New()}} is unusually slow.\r\n[V8Runtime.cpp#L228|https://github.com/appcelerator/titanium_mobile/blob/master/android/runtime/v8/src/native/V8Runtime.cpp#L228]\r\n\r\nBy running adding the following code, I'm able to benchmark this function call.\r\n{code:cpp}\r\n#include \r\nuint64_t GetCurrentTimeInMilliseconds()\r\n{\r\n\tstruct timespec currentTime;\r\n\tclock_gettime(CLOCK_MONOTONIC, ¤tTime);\r\n\tuint64_t value = (uint64_t)currentTime.tv_sec * (uint64_t)1000000;\r\n\tvalue += (uint64_t)currentTime.tv_nsec / (uint64_t)1000;\r\n\treturn value / (uint64_t)1000;\r\n}\r\n\r\nJNIEXPORT void JNICALL Java_org_appcelerator_kroll_runtime_v8_V8Runtime_nativeInit(...)\r\n{\r\n\t// ...\r\n\tuint64_t currentTime = GetCurrentTimeInMilliseconds();\r\n\tisolate = Isolate::New(create_params);\r\n\tLOGI(TAG, \"### Isolate::New() duration: %d\", (int)(GetCurrentTimeInMilliseconds() - currentTime));\r\n\t// ...\r\n}\r\n{code}\r\n\r\nThe below are benchmarks from real physical devices:\r\n* Pixel 2 (Android 9.0; ARM64): {{750ms}}\r\n* Nexus 4 (Android 4.4; ARM32): {{2500ms}}\r\n\r\nThe above eats about half the startup time on a simple \"Hello World\" project. It's unusually slow.\r\n\r\n*To be investigated:*\r\n* Supposedly, creating the {{Isolate}} with an empty snapshot created at build time should significantly improve the performance.\r\n* We should double check that the v8 {{.a}} static library was not compiled in debug mode.\r\n", "attachment": [], "flagged": false, "summary": "Android: Improve V8 cold start performance", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1124, "state": "closed", "name": "2019 Sprint 8", "startDate": "2019-03-31T18:03:00.000Z", "endDate": "2019-04-12T18:03:00.000Z", "completeDate": "2019-04-12T19:04:50.175Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "447399", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master: https://github.com/appcelerator/titanium_mobile/pull/10817\r\nv8_titanium: https://github.com/appcelerator/v8_titanium/pull/44", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-04-01T16:58:15.000+0000", "updated": "2019-04-01T16:58:15.000+0000" }, { "id": "448741", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket, improvement verified in SDK version {{8.1.0.v20190529135224}} performance updates are able to be seen when launching from a cold start. \r\n\r\nTest and other information can be found at: \r\nmaster: https://github.com/appcelerator/titanium_mobile/pull/10817\r\nv8_titanium: https://github.com/appcelerator/v8_titanium/pull/44", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-05-30T13:39:06.000+0000", "updated": "2019-05-30T13:39:06.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }