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

Use memchr for tab-indentation detection #9853

Merged
merged 1 commit into from
Feb 6, 2024
Merged

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Feb 6, 2024

Summary

The benchmarks show a pretty consistent 1% speedup here for all-rules, though not enough to trigger our threshold of course:

Screenshot 2024-02-05 at 11 55 59 PM

Copy link
Contributor

github-actions bot commented Feb 6, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check encountered linter errors. (no lint changes; 1 project error)

sphinx-doc/sphinx (error)

ruff failed
  Cause: Selection of unstable rules without the `--preview` flag is not allowed. Enable preview or remove selection of:
	- FURB113
	- FURB131
	- FURB132

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh changed the title Try fast-path for tab detection Use memchr for tab-indentation detection Feb 6, 2024
@charliermarsh charliermarsh marked this pull request as ready for review February 6, 2024 04:56
@charliermarsh charliermarsh added the performance Potential performance improvement label Feb 6, 2024
Comment on lines +87 to +89
if !indexer.multiline_ranges().contains_range(range) {
return Some(range);
}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I believe the rule will now have a false positive for

a = "b\
		test"

Copy link
Member Author

Choose a reason for hiding this comment

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

I swear I tested this and it wasn't valid but you're totally right. Regardless, we need to solve this for the trailing whitespace rule too.

@charliermarsh charliermarsh merged commit c34908f into main Feb 6, 2024
17 checks passed
@charliermarsh charliermarsh deleted the charlie/tabs branch February 6, 2024 14:44
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.

2 participants