[ALOY-1740] Build times impact by assets & lib files in widget itself
GitHub Issue | n/a |
Type | Bug |
Priority | Critical |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Prashant Saini |
Assignee | Abir Mukherjee |
Created | 2020-09-19T17:13:16.000+0000 |
Updated | 2020-09-27T16:00:21.000+0000 |
Description
*Issue details:*
This issue is about app build times having widgets and categorized in below two scenarios:
widgets having their assets/lib files inside the widget itself into respective folders.
widgets having their assets/lib files inside the main app's assets/lib folders.
*Scenario 1:*
- The build times are directly proportional to the number of controllers because all *assets/lib* files are copied for every single controller into the same destination folder.
- e.g. if we have *100 assets* + *100 lib* files (in widget itself) for a widget with *100 controllers*, then all 100 assets + 100 lib files will be copied *100 times* (means for each controller) into the same destination *"Resources/…"*.
- This even gets worse for the apps having many widgets with hundreds of controllers.
*Scenario 2:*
- The build times are not impacted in this case & are fine as expected.
- e.g. if we have 100 assets + 100 lib files (in main app folder) for a widget with 100 controllers, then all 100 assets + 100 lib files will be copied *only once* into the destination "Resources/…".
- This is how actually the build process should be.
----
*How we observed this issue:*
- We have been recently working on an app improvements which have more than 20 widgets and each widget have approx 50+ controllers with 200+ assets & 6+ lib files. The app also has tons of main controllers, and in total the app has 600+ controllers & 3000+ assets & 150+ lib files.
- This was noticed when we used to have very higher build times as usual and one day we observed something weird on console while building the app.
- Earlier, we used to have build times of over *~ 10-15 mins* on decent MacBook Pro, but after following the below strategies, we were able to pull it down to *~ 2 mins*.
----
*Strategy we followed to work-around this issue:*
- We moved all assets/lib files of each widget into the main app assets/lib folders after creating the separate folders for each widget.
- We used same naming convention as WPATH uses internally for each widget, so we were able to replace all WPATH usages with the folder names we kept in above steps without any regression issues at all, and this is working fine as expected.
----
*Additional note on this issue:*
- Even if any widget contains a hidden *.DS_Store* file inside its assets or lib folders, the build times will be affected in same as described in *Scenario 1*. So this hidden .DS_Store file should not be copied while building the app.
- Because the hidden .DS_Store file is created unknowingly and hardly noticed during build process.
----
*Attached files details to reproduce this issue:*
- There are 3 type of files each for above two scenarios - *.txt, .zip, .mp4*
- *app-1.txt*: contains build logs where you can very easily see how the assets/libs files were copied 100 times for every widget controller. This build process took around *17 seconds* to compile.
- *app-2.txt*: contains build logs where we moved all of the assets/lib files of the widget inside the main app assets/lib folders. This process took just *4 seconds*.
- *app-1.zip* and *app-2.zip* contains required code files (only app folder) for issue reproduction for both scenarios.
- *video-1.mp4* and *video-2.mp4* are the video recordings of the consoles for both scenarios.
_Hope the description and attachments covers all the required information to resolve this issue._
Attachments
No comments