telerik / mobile-cli-lib

Contains common infrastructure for CLIs - mainly AppBuilder, NativeScript, DDB and Proton.
Apache License 2.0
11 stars 10 forks source link

fix: comparing shasums takes a lot of time #1135

Closed rosen-vladimirov closed 6 years ago

rosen-vladimirov commented 6 years ago

Comparing the old shasums and new shasums takes a lot of time as we use find for searching in a map. Instead, just check if we have the entry we are looking for. In bigger projects (for example with more than 20 000 files including node_modules), the comparison may take more than 100 seconds, which breaks the LiveSync for Android as the socket is closed after 70 seconds without action. So, in case you have a huge project and try tns run android, you'll probably receive:

Unable to apply changes on device: 192.168.3.101:5555. Error is: Socket Error:
Error: write ECONNABORTED.

After the change, the time for comparing 24 000 shasums is 25 ms instead of more than 100 seconds