You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Speed up urllib.parse.quote() and quote_plus() for ASCII str inputs #163115
pendingThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement
urllib.parse.quote() and quote_plus() encode str inputs to bytes and delegate toquote_from_bytes(), which runs ''.join(map(quoter, bs)).
For exact ASCII str inputs with ASCII compatible encodings, bypassing that round-trip with str.rstrip() (all-safe) and str.translate() speeds up quote() by 1.25x–1.88x, quote_plus() by 2.0x–2.4x, and urlencode() by 1.7x, with negligible impact on fallback paths and import time.
Related: gh-160690 (ASCII fast path for unquote()).
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
pendingThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement
Activity
pythongh-163115: Speed up urllib.parse.quote() and quote_plus() for A…
picnixz commentedon Dec 3, 2026
I do not think it is worth it. This is usually not the hot path in applications.
picnixz commentedon Dec 3, 2026
I am more worried about the extra complexity added to the code.