From 380a41c2df910a0115a438bd2e6a106a63c83ea9 Mon Sep 17 00:00:00 2001 From: Marcel Bargull Date: Tue, 27 Feb 2024 08:18:05 +0100 Subject: [PATCH 01/19] Use pickle's loads/dumps as a faster deepcopy Signed-off-by: Marcel Bargull --- conda_build/config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conda_build/config.py b/conda_build/config.py index fd599506bc..f6944eaee6 100644 --- a/conda_build/config.py +++ b/conda_build/config.py @@ -9,6 +9,7 @@ import copy import math import os +import pickle import re import shutil import time @@ -817,9 +818,10 @@ def clean_pkgs(self): def copy(self): new = copy.copy(self) - new.variant = copy.deepcopy(self.variant) + # Use picke.loads(pickle.dumps(...) as a faster copy.deepcopy alternative. + new.variant = pickle.loads(pickle.dumps(self.variant, -1)) if hasattr(self, "variants"): - new.variants = copy.deepcopy(self.variants) + new.variants = pickle.loads(pickle.dumps(self.variants, -1)) return new # context management - automatic cleanup if self.dirty or self.keep_old_work is not True From 6e9fdae30f53219ebd83aee3a3558eb3ae611a9d Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Fri, 21 Jun 2024 04:28:53 -0500 Subject: [PATCH 02/19] ref: use clearer protocol spec --- conda_build/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conda_build/config.py b/conda_build/config.py index d782600f32..80c0d54062 100644 --- a/conda_build/config.py +++ b/conda_build/config.py @@ -822,9 +822,9 @@ def clean_pkgs(self): def copy(self) -> Config: new = copy.copy(self) # Use picke.loads(pickle.dumps(...) as a faster copy.deepcopy alternative. - new.variant = pickle.loads(pickle.dumps(self.variant, -1)) + new.variant = pickle.loads(pickle.dumps(self.variant, pickle.HIGHEST_PROTOCOL)) if hasattr(self, "variants"): - new.variants = pickle.loads(pickle.dumps(self.variants, -1)) + new.variants = pickle.loads(pickle.dumps(self.variants, pickle.HIGHEST_PROTOCOL)) return new # context management - automatic cleanup if self.dirty or self.keep_old_work is not True From adf048ac552c4753e91dfead169e663c416645d3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 21 Jun 2024 09:29:55 +0000 Subject: [PATCH 03/19] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- conda_build/config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conda_build/config.py b/conda_build/config.py index 80c0d54062..465058701f 100644 --- a/conda_build/config.py +++ b/conda_build/config.py @@ -824,7 +824,9 @@ def copy(self) -> Config: # Use picke.loads(pickle.dumps(...) as a faster copy.deepcopy alternative. new.variant = pickle.loads(pickle.dumps(self.variant, pickle.HIGHEST_PROTOCOL)) if hasattr(self, "variants"): - new.variants = pickle.loads(pickle.dumps(self.variants, pickle.HIGHEST_PROTOCOL)) + new.variants = pickle.loads( + pickle.dumps(self.variants, pickle.HIGHEST_PROTOCOL) + ) return new # context management - automatic cleanup if self.dirty or self.keep_old_work is not True From 453c49ac9d0518ed23a2b37f4ad5573d00f7f9f3 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Sat, 22 Jun 2024 10:30:53 -0500 Subject: [PATCH 04/19] Create 5281-perf-deepcopy --- news/5281-perf-deepcopy | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 news/5281-perf-deepcopy diff --git a/news/5281-perf-deepcopy b/news/5281-perf-deepcopy new file mode 100644 index 0000000000..b445074ea1 --- /dev/null +++ b/news/5281-perf-deepcopy @@ -0,0 +1,3 @@ +### Enhancements + +* Increased performance by using pickle instead of deepcopy. (#5281) From afff7958149a6a832d1674e1ba9abcf0d0560cc3 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 11:25:38 -0500 Subject: [PATCH 05/19] Update pyproject.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 9bc5272e8c..7f9427fdd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,6 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", + "ignore::DeprecationWarning:tarfile", ] markers = [ "serial: execute test serially (to avoid race conditions)", From 914a727f2485b8ae0f3bbc427af95d1891c7cf83 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 11:33:51 -0500 Subject: [PATCH 06/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7f9427fdd6..b7f677eb60 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - "ignore::DeprecationWarning:tarfile", + "ignore::DeprecationWarning: Python 3.14", ] markers = [ "serial: execute test serially (to avoid race conditions)", From 7057ac7323ba48800b190ea0428e33413a5231a4 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 11:49:35 -0500 Subject: [PATCH 07/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b7f677eb60..3a17fdd45a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - "ignore::DeprecationWarning: Python 3.14", + "ignore:Python 3\.14 will, by default, filter extracted tar archives:DeprecationWarning:tarfile", ] markers = [ "serial: execute test serially (to avoid race conditions)", From b598762346c356986587bcc5f040df647b8c20f5 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 11:51:54 -0500 Subject: [PATCH 08/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3a17fdd45a..b53f63050e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - "ignore:Python 3\.14 will, by default, filter extracted tar archives:DeprecationWarning:tarfile", + "ignore:Python 3\\.14 will, by default, filter extracted tar archives:DeprecationWarning:tarfile", ] markers = [ "serial: execute test serially (to avoid race conditions)", From 57cedc0effd1d966add2a13b2e6687da73243946 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 11:58:36 -0500 Subject: [PATCH 09/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b53f63050e..b845a4c82b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - "ignore:Python 3\\.14 will, by default, filter extracted tar archives:DeprecationWarning:tarfile", + 'ignore:\s+Python 3\.14 will, by default, filter extracted tar archives:DeprecationWarning:tarfile', ] markers = [ "serial: execute test serially (to avoid race conditions)", From 13efaadf2adc8dd7b0a8453c3260fa1415c68757 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 12:03:20 -0500 Subject: [PATCH 10/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b845a4c82b..54b78bb041 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - 'ignore:\s+Python 3\.14 will, by default, filter extracted tar archives:DeprecationWarning:tarfile', + 'ignore:\s+Python 3.14 will, by default, filter extracted tar archives:DeprecationWarning:tarfile', ] markers = [ "serial: execute test serially (to avoid race conditions)", From d2fdf72968a126a336af317a2e210cfcdd8c1d52 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 12:11:27 -0500 Subject: [PATCH 11/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 54b78bb041..72a57aab50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - 'ignore:\s+Python 3.14 will, by default, filter extracted tar archives:DeprecationWarning:tarfile', + 'ignore:\s+Python:DeprecationWarning:tarfile', ] markers = [ "serial: execute test serially (to avoid race conditions)", From a2fde00da86d2afa81a49e92868b109e9f88cd97 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 12:15:07 -0500 Subject: [PATCH 12/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 72a57aab50..fc31dcbaf5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - 'ignore:\s+Python:DeprecationWarning:tarfile', + 'ignore:\s+Python:DeprecationWarning', ] markers = [ "serial: execute test serially (to avoid race conditions)", From 8b48be84dd21cc6d07a6e9dab97c8847272e1f2e Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 12:17:07 -0500 Subject: [PATCH 13/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fc31dcbaf5..5d1356bd79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - 'ignore:\s+Python:DeprecationWarning', + "ignore:Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata:DeprecationWarning:tarfile", ] markers = [ "serial: execute test serially (to avoid race conditions)", From 5331a9943d859b0ba405a5ba3c430d196e771bbb Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 12:24:05 -0500 Subject: [PATCH 14/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5d1356bd79..b0f0def92b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - "ignore:Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata:DeprecationWarning:tarfile", + "ignore::DeprecationWarning", ] markers = [ "serial: execute test serially (to avoid race conditions)", From 9fc176c81a257ec73e2e51b3c1cb4c2639bec31d Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 12:27:16 -0500 Subject: [PATCH 15/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b0f0def92b..7f9427fdd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - "ignore::DeprecationWarning", + "ignore::DeprecationWarning:tarfile", ] markers = [ "serial: execute test serially (to avoid race conditions)", From 591c4981381d96e1a018bcf47a089a23c33c718a Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 12:29:56 -0500 Subject: [PATCH 16/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7f9427fdd6..b0f0def92b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - "ignore::DeprecationWarning:tarfile", + "ignore::DeprecationWarning", ] markers = [ "serial: execute test serially (to avoid race conditions)", From dcc893e81ce73f0fd7604d85fb8e9a98362f8877 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 12:40:38 -0500 Subject: [PATCH 17/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b0f0def92b..52a7795da1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - "ignore::DeprecationWarning", + "ignore::DeprecationWarning:tarfile.py", ] markers = [ "serial: execute test serially (to avoid race conditions)", From ff4f16ef19a3c8cad3eaf4d649e59c576fb3dd9f Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 12:44:28 -0500 Subject: [PATCH 18/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 52a7795da1..c3fc5daa8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - "ignore::DeprecationWarning:tarfile.py", + "ignore:Python:DeprecationWarning", ] markers = [ "serial: execute test serially (to avoid race conditions)", From 38d569af2648d484ad8ed8498603e67238cf5329 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Mon, 24 Jun 2024 12:55:23 -0500 Subject: [PATCH 19/19] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c3fc5daa8f..2726b59495 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,7 +129,7 @@ filterwarnings = [ # ignore conda-index error "ignore::PendingDeprecationWarning:conda_index", "ignore::DeprecationWarning:conda_index", - "ignore:Python:DeprecationWarning", + "ignore:Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata:DeprecationWarning", ] markers = [ "serial: execute test serially (to avoid race conditions)",