Skip to content

Use str.(r)partition instead of .(r)split where appropriate#7507

Closed
scop wants to merge 1 commit into
psf:mainfrom
scop:perf/str-partition
Closed

Use str.(r)partition instead of .(r)split where appropriate#7507
scop wants to merge 1 commit into
psf:mainfrom
scop:perf/str-partition

Conversation

@scop

@scop scop commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Microbenchmark'y, (r)partition is much faster than (r)split on first/last only access.

(r)partition might be a bit harder to reason about though.

Microbenchmark'y, (r)partition is much faster than (r)split on
first/last only access.
@nateprewitt

Copy link
Copy Markdown
Member

Hi @scop, I'm not sure this is a needed change. These are not hot-path operations and function fine today. A quick benchmark shows <20 ns of perf delta in the context of a 10-100+ ms HTTP request. We're talking about a ~0.00002% delta which is effectively noise.

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