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

stbt auto-selftest: Pre-import stbt & dependencies for better performance #560

Merged
merged 1 commit into from
Jan 25, 2019

Conversation

drothlis
Copy link
Contributor

Importing stbt + gstreamer bindings + opencv is slow. On Unix systems
multiprocessing.Pool uses fork so by importing stbt first, these
modules won't be imported from scratch in each subprocess. We use a
different subprocess for each Python file that we analyse.

This saves about 1 second on tests/auto-selftest-example-test-pack.
The improvement will be even larger on test-packs with more Python
files.

This should also make test_auto_selftest_caching more reliable.

…ance

Importing stbt + gstreamer bindings + opencv is slow. On Unix systems
`multiprocessing.Pool` uses `fork` so by importing stbt first, these
modules won't be imported from scratch in each subprocess. We use a
different subprocess for each Python file that we analyse.

This saves about 1 second on `tests/auto-selftest-example-test-pack`.
The improvement will be even larger on test-packs with more Python
files.
Copy link
Contributor

@wmanley wmanley left a comment

Choose a reason for hiding this comment

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

Nice find.

@wmanley wmanley merged commit d828bba into master Jan 25, 2019
@wmanley wmanley deleted the autoselftest-pre-import branch January 25, 2019 16:31
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