{ "id": "171820", "key": "TIMOB-26144", "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": "20238", "description": "", "name": "Release 7.5.0", "archived": false, "released": true, "releaseDate": "2018-11-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-09-19T21:34:26.000+0000", "created": "2018-06-21T02:28:01.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "File", "Filesystem", "android", "performance" ], "versions": [], "issuelinks": [ { "id": "56631", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "inwardIssue": { "id": "171821", "key": "TIMOB-26145", "fields": { "summary": "Windows: Improve File.getDirectoryListing() performance in Resources directory", "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": "Medium", "id": "3" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-10-09T10:40:18.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\nOn Android, accessing files/directories under \"Resources\" is slower than it should be. These files are stored within the APK where a list of file paths from \"assets\" can be easily extracted... which should make it faster than storage access.\r\n\r\n*Test:*\r\nRun the below code to fetch a listing of all files under the \"Resources\" directory. Observe the log for the duration of this function.\r\n{code:javascript}\r\nvar startTime = new Date();\r\nvar file = Ti.Filesystem.getFile(Ti.Filesystem.getResourcesDirectory());\r\nvar listing = file.getDirectoryListing();\r\nTi.API.info(\"@@@ getDirectoryListing() duration: \" + (new Date() - startTime));\r\n{code}\r\n\r\n*Results:*\r\nFor a project have about 160 files under \"Resources\", I get the following results...\r\n* Android 4.1 Emulator: 80 ms\r\n* Galaxy Nexus (Android 4.1): 70 ms\r\n* Amazon Fire HD 8 (7th Generation): 19 ms\r\n* Pixel XL (Android 8.0): 3 ms\r\n\r\n*Recommended Solution:*\r\nAn Android APK is really a zip file. We should open the APK as a zip file and fetch/store all zip entries referencing files under the \"assets\" directory. This way we can have fast hash table lookups when doing existence checks and fetching directory listings.\r\n", "attachment": [], "flagged": false, "summary": "Android: Improve File.getDirectoryListing() performance in Resources directory", "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": 1073, "state": "closed", "name": "2018 Sprint 19 SDK", "startDate": "2018-09-09T21:02:56.422Z", "endDate": "2018-09-23T21:02:00.000Z", "completeDate": "2018-09-23T22:28:10.932Z", "originBoardId": 114 }, { "id": 1058, "state": "closed", "name": "2018 Sprint 16 SDK", "startDate": "2018-07-29T22:26:06.486Z", "endDate": "2018-08-12T22:26:00.000Z", "completeDate": "2018-08-13T17:38:16.757Z", "originBoardId": 114 }, { "id": 1045, "state": "closed", "name": "2018 Sprint 13 SDK", "startDate": "2018-06-17T20:47:13.621Z", "endDate": "2018-07-01T20:47:00.000Z", "completeDate": "2018-07-02T18:40:05.029Z", "originBoardId": 114 }, { "id": 1065, "state": "closed", "name": "2016 Sprint 17 SDK", "startDate": "2018-08-13T17:39:36.846Z", "endDate": "2018-08-27T17:39:00.000Z", "completeDate": "2018-08-29T16:10:57.013Z", "originBoardId": 114 }, { "id": 1050, "state": "closed", "name": "2018 Sprint 14 SDK", "startDate": "2018-07-01T18:40:57.193Z", "endDate": "2018-07-15T18:40:00.000Z", "completeDate": "2018-07-16T03:27:08.720Z", "originBoardId": 114 }, { "id": 1053, "state": "closed", "name": "2018 Sprint 15 SDK", "startDate": "2018-07-15T21:52:05.453Z", "endDate": "2018-07-29T21:52:00.000Z", "completeDate": "2018-07-29T22:25:11.723Z", "originBoardId": 114 }, { "id": 1070, "state": "closed", "name": "2018 Sprint 18 SDK", "startDate": "2018-08-26T16:14:35.297Z", "endDate": "2018-09-09T16:14:00.000Z", "completeDate": "2018-09-11T20:59:21.495Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "438571", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10112", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-21T03:21:53.000+0000", "updated": "2018-06-21T03:21:53.000+0000" }, { "id": "438572", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The above PR makes `getDirectoryListing()` calls under the \"Resources\" directory about 20x faster.\r\n\r\nBelow are test results doing `getDirectoryListing()` with a directory having about 150 files.\r\nShows old time -> new time.\r\n{code}\r\nAndroid 4.1 Emulator: 80 ms -> 3.0 ms\r\nGalaxy Nexus: 70 ms -> 2.5 ms\r\nAmazon Fire HD 8: 19 ms -> 1.0 ms\r\nPixel XL: 3 ms -> 0.5 ms\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-21T03:56:06.000+0000", "updated": "2018-06-21T03:58:08.000+0000" }, { "id": "441633", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed.\r\n\r\n{{getDirectoryListing()}} timing seems to have improved significantly.\r\n\r\nStudio Ver: 5.1.1.201809051655\r\nSDK Ver: 7.5.0 local build\r\nOS Ver: 10.13.5\r\nXcode Ver: Xcode 9.4.1\r\nAppc NPM: 4.2.13\r\nAppc CLI: 7.0.6\r\nDaemon Ver: 1.1.3\r\nTi CLI Ver: 5.1.1\r\nAlloy Ver: 1.13.2\r\nNode Ver: 8.9.1\r\nNPM Ver: 5.5.1\r\nJava Ver: 10.0.2\r\nDevices: ⇨ google Nexus 5 (Android 6.0.1)\r\n ⇨ google Pixel (Android 9)\r\nEmulator: ⇨ Android 4.1.2\r\n", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-09-17T22:57:32.000+0000", "updated": "2018-09-17T22:57:32.000+0000" }, { "id": "441817", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR Merged.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-09-19T21:34:22.000+0000", "updated": "2018-09-19T21:34:22.000+0000" }, { "id": "442435", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket.* Fix can now be verified in SDK version {{7.5.0.v20181008124804.}}\r\n\r\nTest and other information can be found at:\r\nhttps://github.com/appcelerator/titanium_mobile/pull/10112", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-10-09T10:40:12.000+0000", "updated": "2018-10-09T10:40:12.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }