diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 2e97e61abb1..851d96d4960 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -39,6 +39,12 @@ Breaking changes Deprecations ~~~~~~~~~~~~ +Performance +~~~~~~~~~~~ +- Optimize alignment with ``join="exact", copy=False`` by avoiding copies. (:pull:`7736`) + By `Deepak Cherian `_. +- Avoid unnecessary copies of ``CFTimeIndex``. (:pull:`7735`) + By `Deepak Cherian `_. Bug fixes ~~~~~~~~~ diff --git a/xarray/core/alignment.py b/xarray/core/alignment.py index 05e2ca7eb8b..edebccc2534 100644 --- a/xarray/core/alignment.py +++ b/xarray/core/alignment.py @@ -574,6 +574,8 @@ def align(self) -> None: if self.join == "override": self.override_indexes() + elif self.join == "exact" and not self.copy: + self.results = self.objects else: self.reindex_all()