Skip to content

Shorter multiple imports #61

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

embar-
Copy link

@embar- embar- commented Mar 12, 2025

Moving multiple imports from same sources into single call.
This should reduce DBML parse time more than twice.
See #59

@Vanderhoof
Copy link
Owner

Vanderhoof commented Mar 12, 2025

Actually imports organization should not affect the performance. Separate-line imports was a design choice when I was beginning the project, not so sure about it right now, because IDEs like PyCharm manage imports pretty good for you and separate-line imports do not really make much sense at this point. But again, this is just code organization and should not be related to performance issues

@embar-
Copy link
Author

embar- commented Mar 12, 2025

Initially I also had similar thoughts. But actually I am using PyCharm, and indeed reorganization of imports did trick - code is 2-3 times faster. Maybe this is because importing not just functions, but also variable declarations multiple times that calls pp many times.

@Vanderhoof
Copy link
Owner

That's really strange! I just tried parsing the same file with and without collapsed imports, and saw no difference (86ms with one-line imports and 87ms with collapsed)

@embar-
Copy link
Author

embar- commented Mar 12, 2025 via email

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