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

Improve Performance on Auto Detect / Search Logic #29

Open
ebresie opened this issue Oct 30, 2022 · 1 comment
Open

Improve Performance on Auto Detect / Search Logic #29

ebresie opened this issue Oct 30, 2022 · 1 comment

Comments

@ebresie
Copy link
Owner

ebresie commented Oct 30, 2022

As of v0.3.0, during initial startup discovery, the activity is slow as it tries to search through all of the filesystem for possible python platforms not just those on the path. Need to improve performance on auto discover/search functionality.

Means of adding Python Platforms include
(1) User Sets via the Option...Python... Browse functionality
(2) In Tools...Python Platform, Auto Discovery searches everywhere.
(3) In Tools...Python Platform, Add allows browsing and selecting.
(4) In some logic, searching for items on the "PATH" occurs

I believe during some different context may be doing one or the other or both.

For the initial discovery need to change to ensure that it is only using (4) first, if it fails to find then maybe notify the user and attempt (2) as a last resort.

@ebresie
Copy link
Owner Author

ebresie commented Oct 30, 2022

Need to find the flow of this activity.., to make sure there are no duplicate and unnecessary calls. Possible locations to look include:

In FileUtils.findFileOnUsersPath - there are two versions of this, one with a single filename and another with "variable files", the single parameters makes a call to the other. For the given filename or filenames [this could be filenames to look for like "python" "python.exe", etc.] it uses that to compare items based on the "System.getenv("PATH") variable string which is split up to a set of dirs and checks each against the filenames. For all items found, it returns the list of "found" paths. THis is what should be getting used to be similar to how other places look. This would be "path level" checking

In PythonUtils.getPython it calls to FileUtils.findFileOnUsersPath

In PythonAutoDetector.traverseEnvPaths - it gets the path and searches.

In PythonAutoDetector.traverse - it calls to processAction based on directory and recersive flag (renamed typo to recursive), it then further recursively calls traverse on each child folder for "deep level" searching

In PythonAutoDetector.processAction - it takes provides path, determines if file or folder, if it is some form of "Python directory or file and adds to lists of "matched" paths with all applicable Python paths. At the end, then it takes the provided directory and "traverses" each child folder to further search it calls again the "traverse" which again calls processAction. This may result in duplicate searchs.

In PythonAutoDetect.traverseDirectory - it determines if it's a "python directory" and calls process action on this

In PythonOptions,getPython(), it uses PythonUtils.getPython() and sets the option based on the first item found. This seems to be called in a number of context. Need to ensure this is not too many times.

PythonExecutable has PYTHON_NAMES defined depending on if it's windows (and has ".exe" extension) or non-Windows without. At some point if there are other flavors of "python names" like "conda" or "py" then may need to add to this area

"

@ebresie ebresie changed the title Improve AutoDiscovery Logis Improve Performance on Auto Detect / Search Logic Oct 30, 2022
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

No branches or pull requests

1 participant