From c6bdca08aa6c980b776b7a35e34dc6c9443699e7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 22 Jul 2013 14:10:48 +0530 Subject: [PATCH] Micro-optimization for get_categories() by using __slots__ --- src/calibre/db/categories.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/calibre/db/categories.py b/src/calibre/db/categories.py index f80bb52c08..ebd50750a3 100644 --- a/src/calibre/db/categories.py +++ b/src/calibre/db/categories.py @@ -21,6 +21,11 @@ CATEGORY_SORTS = ('name', 'popularity', 'rating') # This has to be a tuple not class Tag(object): + if tweaks.get('use_new_db', False): + __slots__ = ('name', 'original_name', 'id', 'count', 'state', 'is_hierarchical', + 'is_editable', 'is_searchable', 'id_set', 'avg_rating', 'sort', + 'use_sort_as_name', 'tooltip', 'icon', 'category') + def __init__(self, name, id=None, count=0, state=0, avg=0, sort=None, tooltip=None, icon=None, category=None, id_set=None, is_editable=True, is_searchable=True, use_sort_as_name=False):