From 887b199e8f1b54ee7d8ba73a71f8602f77138d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Mon, 11 Dec 2006 09:20:30 +0000 Subject: [PATCH] refactor plan... --- RefactorPlan | 8 ++++ remove_unused_attributes.patch | 76 ++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 remove_unused_attributes.patch diff --git a/RefactorPlan b/RefactorPlan index 1300f81c..acfadacf 100644 --- a/RefactorPlan +++ b/RefactorPlan @@ -62,3 +62,11 @@ out exact error is try to parse error string (which is localized). ==> database * brr... + +==> class attributes +* In some classes there are some attributes assigned but never +used. (see remove_unused_attributes.patch) + +* PiSi uses heavy classes and creates thousands of instances of them + (Package, Metadata, Dependency, ...). These classes should define + __slots__ to reduce the heap used. \ No newline at end of file diff --git a/remove_unused_attributes.patch b/remove_unused_attributes.patch new file mode 100644 index 00000000..887a0a94 --- /dev/null +++ b/remove_unused_attributes.patch @@ -0,0 +1,76 @@ +Index: pisi/atomicoperations.py +=================================================================== +--- pisi/atomicoperations.py (revision 11473) ++++ pisi/atomicoperations.py (working copy) +@@ -42,12 +42,8 @@ + + class AtomicOperation(object): + +- def __init__(self, ignore_dep = None): +- #self.package = package +- if ignore_dep==None: +- self.ignore_dep = ctx.config.get_option('ignore_dependency') +- else: +- self.ignore_dep = ignore_dep ++ def __init__(self): ++ pass + + def run(self, package): + "perform an atomic package operation" +@@ -58,7 +54,7 @@ + "Install class, provides install routines for pisi packages" + + @staticmethod +- def from_name(name, ignore_dep = None): ++ def from_name(name): + # download package and return an installer object + # find package in repository + repo = ctx.packagedb.which_repo(name) +@@ -77,13 +73,13 @@ + + ctx.ui.info(_("Package URI: %s") % pkg_path, verbose=True) + +- return Install(pkg_path, ignore_dep) ++ return Install(pkg_path) + else: + raise Error(_("Package %s not found in any active repository.") % name) + +- def __init__(self, package_fname, ignore_dep = None, ignore_file_conflicts = None): ++ def __init__(self, package_fname, ignore_file_conflicts = None): + "initialize from a file name" +- super(Install, self).__init__(ignore_dep) ++ super(Install, self).__init__() + if not ignore_file_conflicts: + ignore_file_conflicts = ctx.get_option('ignore_file_conflicts') + self.ignore_file_conflicts = ignore_file_conflicts +@@ -394,8 +390,8 @@ + + class Remove(AtomicOperation): + +- def __init__(self, package_name, ignore_dep = None): +- super(Remove, self).__init__(ignore_dep) ++ def __init__(self, package_name): ++ super(Remove, self).__init__() + self.package_name = package_name + self.package = ctx.packagedb.get_package(self.package_name, pisi.itembyrepodb.installed) + try: +Index: pisi/archive.py +=================================================================== +--- pisi/archive.py (revision 11473) ++++ pisi/archive.py (working copy) +@@ -42,12 +42,11 @@ + self.type = atype + + def unpack(self, target_dir, clean_dir = False): +- self.target_dir = target_dir + # first we check if we need to clean-up our working env. +- if os.path.exists(self.target_dir) and clean_dir: +- util.clean_dir(self.target_dir) ++ if os.path.exists(target_dir) and clean_dir: ++ util.clean_dir(target_dir) + +- os.makedirs(self.target_dir) ++ os.makedirs(target_dir) + + + class ArchiveBinary(ArchiveBase):