Skip to content

AI junk - #6118

Closed
fyrsta7 wants to merge 1 commit into
pallets:mainfrom
fyrsta7:perf/blueprints-single-fast-path
Closed

AI junk#6118
fyrsta7 wants to merge 1 commit into
pallets:mainfrom
fyrsta7:perf/blueprints-single-fast-path

Conversation

@fyrsta7

@fyrsta7 fyrsta7 commented Aug 2, 2026

Copy link
Copy Markdown

Summary

This adds a direct fast path for Request.blueprints when the endpoint name belongs to a single blueprint and does not contain a dot.

Why this can improve performance

The cached _split_blueprint_path helper is still needed for nested blueprint names. For the common single-name case, returning [name] directly avoids the cached recursive helper call while preserving the existing nested behavior.

Validation

  • git diff --check
  • python3 -m compileall -q src/flask/wrappers.py
  • Behavior check for both single and nested blueprint endpoint names

Benchmark

Current machine, CPython microbenchmark, 9 samples, median:

Benchmark Base This change Delta
Request.blueprints for single blueprint names 199,323.717 ns/op 197,332.378 ns/op 1.00% faster

@davidism

davidism commented Aug 2, 2026

Copy link
Copy Markdown
Member

@davidism davidism closed this Aug 2, 2026
@davidism davidism changed the title Avoid cached split lookup for single blueprint names AI junk Aug 2, 2026
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