Skip to content

feat: Speed up device detection #3717

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 1 commit into from
Jul 15, 2018

Conversation

rosen-vladimirov
Copy link
Contributor

@rosen-vladimirov rosen-vladimirov commented Jul 2, 2018

Speed up device detection by:

  • removing duplicate calls to all device detection services
  • cache the Promise of initialize method - this way even when multiple calls are executed simultaneously, the result of the first one will be used. This allows Sidekick to call the method asynchronously.
  • do not execute iOS device detection in case --emulator is passed

Remove several public methods from the service - make them protected as we already have tests for them.
Remove all calls to detectCurrentlyAttachedDevices method outside of the service - the initialize method will do it anyway, so no need to call it externally.
Remove duplicate calls in the startLookingForDevices method - previously it had to filter which device detection services to call. As now each device detection service checks its platform, we can safely call all of them and rely on their filters to skip the execution.

PR Checklist

What is the current behavior?

$ tns run ios --emulator tries to find attached iOS devices. When there's no such, it takes 6 seconds to complete.

What is the new behavior?

$ tns run ios --emulator does not search for connected iOS devices, so when you do not have iOS devices attached, the command is with 6 seconds faster than before.

NOTE: Merge after telerik/mobile-cli-lib#1099

@rosen-vladimirov rosen-vladimirov added this to the 4.2.0 milestone Jul 2, 2018
@rosen-vladimirov rosen-vladimirov self-assigned this Jul 2, 2018
@Natalia-Hristova Natalia-Hristova modified the milestone: 4.2.0 Jul 6, 2018
@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/improve-dev-detection branch 2 times, most recently from a44bf99 to 4258d7e Compare July 13, 2018 10:46
Speed up device detection by:
* removing duplicate calls to all device detection services
* cache the Promise of initialize method - this way even when multiple calls are executed simultaneously, the result of the first one will be used. This allows Sidekick to call the method asynchronously.
* do not execute iOS device detection login in case `--emulator` is passed

Remove several public methods from the service - make them protected as we already have tests for them.
Remove all calls to detectCurrentlyAttachedDevices method outside of the service - the initialize method will do it anyway, so no need to call it externally.
Remove duplicate calls in the startLookingForDevices method - previously it had to filter which device detection services to call. As now each device detection service checks its platform, we can safely call all of them and rely on their filters to skip the execution.
@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/improve-dev-detection branch from 4258d7e to 6793191 Compare July 14, 2018 20:51
@rosen-vladimirov rosen-vladimirov merged commit 0f403d2 into master Jul 15, 2018
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/improve-dev-detection branch July 15, 2018 20:15
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.

3 participants