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

Avoid allocations for isort module names #11251

Merged
merged 1 commit into from
May 2, 2024
Merged

Avoid allocations for isort module names #11251

merged 1 commit into from
May 2, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Random refactor I noticed when investigating the F401 changes. We don't need to allocate in most cases here.

@charliermarsh charliermarsh added the performance Potential performance improvement label May 2, 2024
Comment on lines 722 to 724
let mut module_name = String::with_capacity(
(level as usize) + module.as_ref().map_or(0, |module| module.len()),
);
Copy link
Member

Choose a reason for hiding this comment

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

👀

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it bad

Copy link
Member

Choose a reason for hiding this comment

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

Does it need the as_ref 🤔

@charliermarsh charliermarsh force-pushed the charlie/cow branch 2 times, most recently from dd402ec to ee597c6 Compare May 2, 2024 19:03
@charliermarsh charliermarsh enabled auto-merge (squash) May 2, 2024 19:07
@charliermarsh charliermarsh merged commit 9a1f6f6 into main May 2, 2024
19 checks passed
@charliermarsh charliermarsh deleted the charlie/cow branch May 2, 2024 19:17
Copy link
Contributor

github-actions bot commented May 2, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Potential performance improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants