From 6db7cd19b6ea4f9aea785e84c3c178fdc163ba08 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 13 Jan 2012 11:52:25 -0500 Subject: cherry-picked a2cc392 Switch to shallow rather than deep copies to improve performance --- src/lib/Server/Lint/MergeFiles.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib/Server/Lint/MergeFiles.py') diff --git a/src/lib/Server/Lint/MergeFiles.py b/src/lib/Server/Lint/MergeFiles.py index 52fea3d9b..ff6e3449a 100644 --- a/src/lib/Server/Lint/MergeFiles.py +++ b/src/lib/Server/Lint/MergeFiles.py @@ -1,5 +1,5 @@ import os -from copy import deepcopy +import copy from difflib import SequenceMatcher import Bcfg2.Server.Lint @@ -43,7 +43,7 @@ class MergeFiles(Bcfg2.Server.Lint.ServerPlugin): rv = [] elist = entries.items() while elist: - result = self._find_similar(elist.pop(0), deepcopy(elist), + result = self._find_similar(elist.pop(0), copy.copy(elist), threshold) if len(result) > 1: elist = [(fname, fdata) @@ -62,7 +62,7 @@ class MergeFiles(Bcfg2.Server.Lint.ServerPlugin): if (sm.real_quick_ratio() > threshold and sm.quick_ratio() > threshold and sm.ratio() > threshold): - rv.extend(self._find_similar((cname, cdata), deepcopy(others), + rv.extend(self._find_similar((cname, cdata), copy.copy(others), threshold)) return rv -- cgit v1.2.3-1-g7c22