Skip to content

Commit

Permalink
Make scheme a cached property as well (#1058)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Aug 30, 2024
1 parent e3dd736 commit 822097a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGES/1044.misc.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
``raw_host`` and ``port`` are now ``cached_property`` -- by :user:`bdraco`.
``port``, ``scheme``, and ``raw_host`` are now ``cached_property`` -- by :user:`bdraco`.

``aiohttp`` accesses these properties quite often, which cause :mod:`urllib` to build the ``_hostinfo`` property every time. ``raw_host`` and ``port`` are now cached properties, which will improve performance.
``aiohttp`` accesses these properties quite often, which cause :mod:`urllib` to build the ``_hostinfo`` property every time. ``port``, ``scheme``, and ``raw_host`` are now cached properties, which will improve performance.
1 change: 1 addition & 0 deletions CHANGES/1058.misc.rst
2 changes: 1 addition & 1 deletion yarl/_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def relative(self):
val = self._val._replace(scheme="", netloc="")
return URL(val, encoded=True)

@property
@cached_property
def scheme(self):
"""Scheme for absolute URLs.
Expand Down

0 comments on commit 822097a

Please sign in to comment.