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

Make performance improvements #6

Merged
merged 11 commits into from
Apr 20, 2023
Merged

Conversation

hsaunders1904
Copy link
Owner

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2023

Codecov Report

Merging #6 (af3ea42) into main (76f791a) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main        #6   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          141       145    +4     
=========================================
+ Hits           141       145    +4     
Impacted Files Coverage Δ
pyautoenv.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

It's got a relatively large import time, mostly because it's using
regexes under-the-hood. Use `sys.platform` instead. `sys` is already
imported and has the platform as an attribute.
We don't need to spend time importing these unless we know we're looking
for a poetry venv.
Hand role an enum so we can avoid the import.
This saves ~0.03 ms, which is a ~25% speed-up.

It's a shame, because I like the pathlib API, but speed is king for this
application.
This avoids another import, as saves a millisecond or two.
A very minor optimisation, that means we're not repeating the logic used
to get the current operating system.
We can quite happily deal with relative paths.
This reverts commit 05182ef.

This introduced a bug where entering a sub-directory would deactivate
the environment.
@hsaunders1904 hsaunders1904 force-pushed the make_performance_improvements branch from 690f97d to af3ea42 Compare April 20, 2023 08:03
@hsaunders1904 hsaunders1904 merged commit 94dedaf into main Apr 20, 2023
@hsaunders1904 hsaunders1904 deleted the make_performance_improvements branch April 20, 2023 08:08
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.

2 participants