{ "id": "165255", "key": "TIMOB-24293", "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": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2017-05-02T17:21:37.000+0000", "created": "2017-01-11T13:07:26.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "merge-6.0.2", "require" ], "versions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" }, { "id": "18154", "name": "Release 6.0.1", "archived": false, "released": true, "releaseDate": "2016-12-21" } ], "issuelinks": [ { "id": "53938", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "164051", "key": "ALOY-1523", "fields": { "summary": "Alloy uses old require-paths with new require-behavior", "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": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "53939", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "124137", "key": "TIMOB-16078", "fields": { "summary": "Implement full NodeJS require specs so we can use NPM for modules", "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": "Critical", "id": "1" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2017-05-02T17:21:37.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": "We're using a lot of requires in the app. Also with databinding we use require for every row. This used to work great with 5.# but now it seems to try something else. It tries to load the node_module first, then tries to find the controller/lib file resulting in a log like this:\r\n\r\n{code}\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location, Resource: node_modules/libs/Location\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location.js, Resource: node_modules/libs/Location_js\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location.json, Resource: node_modules/libs/Location_json\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/package.json, Resource: node_modules/libs/Location/package_json\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/index.js, Resource: node_modules/libs/Location/index_js\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/index.json, Resource: node_modules/libs/Location/index_json\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location, Resource: node_modules/libs/Location\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location.js, Resource: node_modules/libs/Location_js\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location.json, Resource: node_modules/libs/Location_json\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/package.json, Resource: node_modules/libs/Location/package_json\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/index.js, Resource: node_modules/libs/Location/index_js\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/index.json, Resource: node_modules/libs/Location/index_json\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/libs/Location, Resource: libs/Location\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/libs/Location.js, Resource: libs/Location_js\r\n{code}\r\n\r\nThis happens for every require.\r\n\r\n{code}require('libs/location.js');{code}\r\n\r\nIs how it was implemented. This solves the node_modules problem in the log\r\n\r\n{code}require('/libs/location.js');{code}\r\n\r\nsidenote: we have a libs folder in our lib folder, it is not a typo", "attachment": [], "flagged": false, "summary": "Alloy: iOS - Using require() without \"/\" prefix will try to load file relatively node_modules first, other unrelated logs and behavior changes", "creator": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Using TiSDK 6.0.1 or the latest 6.1 nightly. Tried CLI 6.0 and 6.1", "comment": { "comments": [ { "id": "404451", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~cbarber] cb-tooling?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-11T13:11:20.000+0000", "updated": "2017-01-11T13:11:20.000+0000" }, { "id": "404453", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "There is no workaround for \r\n\r\n{code}{code}\r\n\r\nThis is generated to be a require without a prefixed slash. And it does try to load node_modules first even if I add a prefixed slash to the src. ", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-11T13:42:47.000+0000", "updated": "2017-01-11T14:33:08.000+0000" }, { "id": "404459", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "I doubt this is a tooling thing. [~cwilliams] did you touch {{require()}} on iOS? Any idea?", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2017-01-11T16:13:13.000+0000", "updated": "2017-01-11T16:13:13.000+0000" }, { "id": "404486", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Here is an example of this behavior:\r\n\r\napp.js\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Trigger'\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n var more = require('more');\r\n alert(more.test);\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n{code}\r\nmore.js\r\n{code:js}\r\nexports.test = 'Hello world!';\r\n{code}\r\nAnd the output when hitting the trigger button once (!):\r\n{code}\r\n2017-01-11 21:40:43.321 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/more/more.js, Resource: more/more_js\r\n2017-01-11 21:40:43.321 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/more/more.js.js, Resource: more/more_js_js\r\n2017-01-11 21:40:43.322 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/more/more.js.json, Resource: more/more_js_json\r\n2017-01-11 21:40:43.322 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/more/package.json, Resource: more/package_json\r\n2017-01-11 21:40:43.322 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/more/index.js, Resource: more/index_js\r\n2017-01-11 21:40:43.322 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/more/index.json, Resource: more/index_json\r\n2017-01-11 21:40:43.323 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more, Resource: node_modules/more\r\n2017-01-11 21:40:43.323 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more.js, Resource: node_modules/more_js\r\n2017-01-11 21:40:43.323 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more.json, Resource: node_modules/more_json\r\n2017-01-11 21:40:43.324 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more/package.json, Resource: node_modules/more/package_json\r\n2017-01-11 21:40:43.324 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more/index.js, Resource: node_modules/more/index_js\r\n2017-01-11 21:40:43.324 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more/index.json, Resource: node_modules/more/index_json\r\n2017-01-11 21:40:43.324 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more, Resource: node_modules/more\r\n2017-01-11 21:40:43.325 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more.js, Resource: node_modules/more_js\r\n2017-01-11 21:40:43.325 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more.json, Resource: node_modules/more_json\r\n2017-01-11 21:40:43.325 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more/package.json, Resource: node_modules/more/package_json\r\n2017-01-11 21:40:43.325 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more/index.js, Resource: node_modules/more/index_js\r\n2017-01-11 21:40:43.326 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/node_modules/more/index.json, Resource: node_modules/more/index_json\r\n2017-01-11 21:40:47.878 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/more, Resource: more\r\n2017-01-11 21:40:47.878 Titanium[18334:371252] [DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/71AEF689-1EC2-4030-A030-7E2388538EA2/data/Containers/Bundle/Application/61BBCAF8-F029-480A-B327-325BFA0193BC/Titanium.app/more.js, Resource: more_js\r\n{code}\r\n\r\nSo the effort here would be to detect the correct location earlier to prevent the above file operations that cause the app to slow down as described.\r\n\r\nThe behavior can be debugged by setting a break-point [here|https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/KrollBridge.m#L916] and {{po path}} to the see path. The log is generated by the {{loadAppResource}} method.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-11T20:45:15.000+0000", "updated": "2017-01-11T20:45:24.000+0000" }, { "id": "404613", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "More test-cases incoming!\r\n\r\nUsing my open-sourced canteen app (), there are 10x more logs in 6.0.1.GA compared to 5.5.1.GA:\r\n- 6.0.1.GA: https://gist.github.com/hansemannn/104345f36377cfd434c967e379ae2347\r\n- 5.5.1.GA: https://gist.github.com/hansemannn/ab1f0e0978a393064846a1ffc13c59ba\r\n\r\nI also noted the following other differences:\r\n5.5.1.GA:\r\n{code}\r\n-- Start simulator log -------------------------------------------------------\r\n[INFO] Application started\r\n[DEBUG] Reading stylesheet from: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/B1E64A97-DC1C-482D-BA35-CCC66CFF1479/data/Containers/Bundle/Application/E05B2B87-41C8-48B4-A106-F9DB29FAFDC9/Mensa.app/stylesheet.plist\r\n[INFO] Mensa/3.0.0 (5.5.1.b18727f)\r\n{code}\r\n6.0.1.GA:\r\n{code}\r\n-- Start simulator log -------------------------------------------------------\r\n[DEBUG] Loading: /Users/hknoechel/Library/Developer/CoreSimulator/Devices/B1E64A97-DC1C-482D-BA35-CCC66CFF1479/data/Containers/Bundle/Application/EECBC008-0CA2-47B5-9A0B-EA022A8A89E7/Mensa.app/lloy/controllers/lunches/node_modules/alloy.js, Resource: lloy/controllers/lunches/node_modules/alloy_js\r\n[DEBUG] {\"tiSDKVersion\":\"6.0.1\",\"githash\":\"__GITHASH__\",\"deployType\":\"development\",\"appId\":\"de.hansknoechel.mensaapp\",\"version\":\"3.0.0\",\"guid\":\"46ee97ea-53fa-43fe-9888-47e86daea053\",\"name\":\"Mensa\"}\r\n{code}\r\nSo either we removed those logs as part of the logs-changes in 6.0.1.GA or their output it missing.\r\n\r\nAlso, there is a path \"/lloy/\" (instead of /alloy/). Note: this only happens when trying to load the alloy.js in /node_modules/ (which also does not exist).", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-14T10:48:49.000+0000", "updated": "2017-01-14T10:51:29.000+0000" }, { "id": "404700", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Lets keep in mind it also slows down the app massively and is possibly blocking a release with 6.0.1 because we use a LOT of requires in our app (lots of alloy requires inside xml files).\r\n\r\nWill this please be released as a hotfix of 6.0.1?", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-17T15:02:41.000+0000", "updated": "2017-01-17T15:02:41.000+0000" }, { "id": "404702", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "This is not a tooling thing. This is intentional - we changed require behavior to be more in line with Node.JS/CommonJS style. When we run into an un-prefixed path we don't know if it's intentionally un-prefixed or not, and we need to try and preserve the ability to handle un-prefixed paths as we did before when it isn't.\r\n\r\nSo If it's a single path segment that's un-prefixed - yeah we will attempt to see if it's a core(read: native) module first, then we'll see if it's a CommonJS module, then we'll try and see if it might be a node_module, and lastly we'll fall back to legacy Titanium behavior of assuming it's actually intended to be an \"absolute\" path with no prefix.\r\n\r\nForm Hans' logs above, I see a bug in that we appear to be checking the node_modules area twice - if that's consistent, that is a bug to be fixed.\r\n\r\nWe should update alloy to generate prefixed paths in Titanium 6+, to help trim the possibility set of where we look (and I think we already have a ticket for this).\r\n\r\nI think it'd also be useful to gather a little more timing data to see what slowdowns this may be causing and where exactly. Looking at Hans's logs above it appears that the \"misses\" look to be taking roughly 1/3 to 1/4ms each, which doesn't seem huge to me. But I **do** see a major slowdown between the node_modules check to the legacy fallback of ~4.5s - is that just an aberration, or consistent?", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2017-01-17T15:52:46.000+0000", "updated": "2017-01-17T16:46:16.000+0000" }, { "id": "404704", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "A common functionality is to have a transform function with data binding. Within this transform function we call a couple methods from lib files. Without it actually being specified a big listview (with hundreds of models) caused delays of 1-2 seconds compared to previously. With the leading `/` it was fixed.\r\n\r\nAnother common problem, where we have a lot in the app, is using require inside the xml files. These try the same functionality and there it is impossible to fix it ourselves. With big views, and loads of requires, that too caused big delays for us. This in combination with each other made a very slow app.\r\n\r\nIf the leading \"/\" is a requirement now it should also work with Alloy XML files and communicated clearly as a breaking change. Until now it was never communicated it was a requirement, and if my memory is correct it at first didn't even work correctly in the past. \r\n\r\nThe blogpost for 6.0 didn't mention this, and in the releasenotes nothing is told about it being required if you want to keep performance high, only it will fall back to the default.\r\n\r\nSo conclusion, for a couple requires it is not that bad, but many apps use A LOT, which slows down the app massively", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-17T16:26:23.000+0000", "updated": "2017-01-17T16:26:23.000+0000" }, { "id": "408301", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "I'm sad this ticket didn't make it into 6.0.2. It really is a critical thing. \r\nThis also happens for any require inside an alloy view. So if you use a require in, say, a controller for a row in tableview, a tableview filled with 100 items will trigger 100 times... every time. It is heavily slowing down everything in the app", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-03-02T12:19:11.000+0000", "updated": "2017-03-02T12:19:11.000+0000" }, { "id": "409495", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "{code}\r\n\r\nAlloy.createController = function(name, args) {\r\n return new (require(\"/alloy/controllers/\" + name))(args);\r\n};\r\n\r\nAlloy.createModel = function(name, args) {\r\n return new (require(\"/alloy/models/\" + ucfirst(name)).Model)(args);\r\n};\r\n\r\nAlloy.createCollection = function(name, args) {\r\n return new (require(\"/alloy/models/\" + ucfirst(name)).Collection)(args);\r\n};\r\n{code}\r\nAdding this code to Alloy.js will greatly improve performance of the app. But it still is a performance hit on the app as there still are many logs still like this:\r\n\r\n{code}\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/2BD2A8E3-6D77-4476-AADA-097C7D2FB7A2/Roamler.app/libs/Utils/Display, Resource: libs/Utils/Display\r\n[DEBUG] : Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/2BD2A8E3-6D77-4476-AADA-097C7D2FB7A2/Roamler.app/libs/Utils/Display.js, Resource: libs/Utils/Display_js\r\n{code}\r\nCompared to Pre 6.0 it was much faster and these logs didn't show up. \r\n\r\nNote: disabling logs (production builds) are also slower without the manual improvements, so it for sure is everywhere.", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-03-07T13:49:55.000+0000", "updated": "2017-03-07T13:49:55.000+0000" }, { "id": "409670", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "This adjustment to the createController function made it, compared to above, blazing fast:\r\n\r\n{code:javascript}\r\n\r\nvar requiredControllers = {};\r\nAlloy.createController = function(name, args) {\r\n if (!requiredControllers[name]){\r\n requiredControllers[name] = require(\"/alloy/controllers/\" + name);\r\n }\r\n return new (requiredControllers[name])(args);\r\n};\r\n{code}\r\nSame works for other 2 functions. As you can see I store the result of the require. It now feels, in terms of speed, what is was before 6.0", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-03-07T22:55:25.000+0000", "updated": "2017-03-07T22:55:51.000+0000" }, { "id": "417134", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~topener] Have this changes been included in require-fix Alloy PR from recently? I remember you said something related. Thanks man!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-10T18:28:19.000+0000", "updated": "2017-04-10T18:28:19.000+0000" }, { "id": "417138", "author": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "body": "Although there is a performance hit with searching for the module, I would not want to vary at from looking in node_modules first, if the '/' prefix is not used, as this is the way nodejs resolves module locations. A lot of the performance issues could be handled at compile time (instead of at runtime). See nativeloop (https://github.com/nativeloop/nativeloop) for an example of resolving module paths at compile time.", "updateAuthor": { "name": "brentonhouse", "key": "brentonhouse", "displayName": "Brenton House", "active": true, "timeZone": "America/Chicago" }, "created": "2017-04-10T18:59:19.000+0000", "updated": "2017-04-10T18:59:19.000+0000" }, { "id": "418605", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "Fixed by ALOY-1523.", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2017-05-02T17:21:37.000+0000", "updated": "2017-05-02T17:21:37.000+0000" } ], "maxResults": 15, "total": 15, "startAt": 0 } } }