Skip to content

fix: comparing shasums takes a lot of time #3869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2018

Conversation

rosen-vladimirov
Copy link
Contributor

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

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
@rosen-vladimirov rosen-vladimirov added this to the 4.2.4 milestone Sep 5, 2018
@rosen-vladimirov rosen-vladimirov self-assigned this Sep 5, 2018
@rosen-vladimirov rosen-vladimirov merged commit 6b190db into release Sep 10, 2018
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-livesync-many-files branch September 10, 2018 06:45
@rosen-vladimirov
Copy link
Contributor Author

Fixes #3894

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants