-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
poetry startup time is slow #3502
Comments
Probably could have been filed as "feature request" instead of "bug". |
@sinoroc I wasn't sure, because it didn't feel like a feature request per se, because older versions of poetry were faster (poetry 1.0 is consistently under 350ms), but I can change the label |
No worries. I just mentioned it. Maintainers will decide. Maybe it is worth editing the first message to clearly show that it could be a regression (i.e. it used to be faster). |
A bunch of imports for commands need to be moved to |
@jules-ch could you point me to specific candidates, I'll try to send a PR |
#3618 might help. I think we can wait & see if that improves performance. |
@jules-ch I gave poetry 1.1.5 a try, it did slightly improve things, but it's still about ~500ms slower than native code run. |
This change speeds up poetry command start time by 50ms compared to current master and around 250ms compared to 1.1.5. Relates-to: python-poetry#3502
@yoav-orca can you try master? Should get you to around ~300ms. And #3938 will get you to ~250ms. (obviously times here are dependent on externa factors too). Using pipxpipx install --suffix=@3938 'poetry @ git+https://github.com/python-poetry/poetry.git@refs/pull/3938/head'
PYTHONPROFILEIMPORTTIME=1 poetry@3938 run /usr/bin/true 2>imports.txt pipx install --suffix=@master 'poetry @ git+https://github.com/python-poetry/poetry.git@master'
PYTHONPROFILEIMPORTTIME=1 poetry@master run /usr/bin/true 2>imports.txt |
Hi @abn I tried both versions My setup: Empty poetry
With 3938:
At master:
The diagram looks very similar to both branches, I'm adding the diagram for 3938: BTW when running on a non-empty project (~50 dependencies) I see a spike of 100-150 ms on startup time. |
This change speeds up poetry command start time by 50ms compared to current master and around 250ms compared to 1.1.5. Relates-to: python-poetry#3502
This change speeds up poetry command start time by 50ms compared to current master and around 250ms compared to 1.1.5. Relates-to: #3502
This change speeds up poetry command start time by 50ms compared to current master and around 250ms compared to 1.1.5. Relates-to: python-poetry#3502
This change speeds up poetry command start time by 50ms compared to current master and around 250ms compared to 1.1.5. Relates-to: python-poetry#3502
@abn, @yoav-orca May I ask what the target performance is for this issue to be considered resolved? Based on yoav-orca's latest comment, it looked like the timing of
|
We really need this to get going/resolved as it is the sole serious issue in the 1.2 project besides another one. |
"poetry run" is very slow[1] and adds +1 second to the startup time. This is made even worse by the fact that aurweb-git-serve is called twice by sshd[2]. [1] python-poetry/poetry#3502 [2] https://security.stackexchange.com/questions/123795/authorizedkeyscommand-of-sshd-config-getting-called-twice/123801#123801
I'm going to close this as current speeds are not a regression -- I'd suggest opening issues for specific commands/sections of code with specific targets if anyone finds any unnecessary hot loops or blocking behavior. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option).Issue
I'll start by saying that poetry is awesome, it made me and my team more productive since we migrated from Pipenv!
I use the poetry
run
/shell
commands a lot in my daily routine, I also use poetry as a wrapper to other tools that I use from my IDE & git hooks. However, there's an overhead when running commands with poetry:It seems that running commands with poetry adds between 570-930ms latency to the command.
I tried to profile the issue, and it seems that most of the time is spent in the import statements before the main is called, the main itself is only 90ms.
I tried to profile the imports with
PYTHONPROFILEIMPORTTIME
as follows:PYTHONPROFILEIMPORTTIME=1 poetry run /usr/bin/true 2>imports.txt
I visualized the results using tuna as follows:
The results indicate that most of the time is used in imports that are not used by the
run
/shell
commands.I propose using LazyLoader to improve the startup time and responsiveness of poetry.
The text was updated successfully, but these errors were encountered: