Skip to content
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

refactor: Change simulator state detection logic to use faster APIs #284

Merged
merged 2 commits into from
Aug 21, 2020

Conversation

mykola-mokhnach
Copy link
Contributor

The stat method internally invokes simctl list, which could be pretty slow, especially if multiple simulators are installed on the system. I've switched the state detection API to use getenv call as a workaround. In opposite to the list call it only queries single simulator, which makes the overall performance better. On my machine the timings were:

$ time xcrun simctl getenv 0B2C9CE6-29AC-4494-B64F-CE711619146E dummy
...
xcrun simctl getenv 0B2C9CE6-29AC-4494-B64F-CE711619146E dummy  0.08s user 0.09s system 88% cpu 0.184 total
$ % time xcrun simctl list
....
xcrun simctl list  0.11s user 0.20s system 43% cpu 0.723 total

@mykola-mokhnach
Copy link
Contributor Author

cc @sauce-tartar

Copy link
Member

@KazuCocoa KazuCocoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to find it.
I also measured the performance on my machine (same result)

@mykola-mokhnach mykola-mokhnach merged commit af21a66 into appium:master Aug 21, 2020
@mykola-mokhnach mykola-mokhnach deleted the fast_running branch August 21, 2020 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants