Return-Path: Received: from dan.rpsys.net (dan.rpsys.net [93.97.175.187]) by mail.openembedded.org (Postfix) with ESMTP id A9CA060A88 for ; Mon, 16 Sep 2013 21:53:59 +0000 (UTC) Received: from localhost (dan.rpsys.net [127.0.0.1]) by dan.rpsys.net (8.14.4/8.14.4/Debian-2.1ubuntu1) with ESMTP id r8GM87Ex029321; Mon, 16 Sep 2013 23:08:07 +0100 X-Virus-Scanned: Debian amavisd-new at dan.rpsys.net Received: from dan.rpsys.net ([127.0.0.1]) by localhost (dan.rpsys.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9c_DFELGkxRx; Mon, 16 Sep 2013 23:08:07 +0100 (BST) Received: from ted (bebox.config [93.97.175.187] (may be forged)) (authenticated bits=0) by dan.rpsys.net (8.14.4/8.14.4/Debian-2.1ubuntu1) with ESMTP id r8GM84ki029296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 16 Sep 2013 23:08:05 +0100 Received: from richard by ted with local (Exim 4.80) (envelope-from ) id 1VLgjr-0002ZC-2i; Mon, 16 Sep 2013 22:53:47 +0100 From: Richard Purdie To: bitbake-devel@lists.openembedded.org Date: Mon, 16 Sep 2013 22:53:19 +0100 Message-Id: <1379368413-9808-2-git-send-email-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1379368413-9808-1-git-send-email-richard.purdie@linuxfoundation.org> References: <1379368413-9808-1-git-send-email-richard.purdie@linuxfoundation.org> Subject: [PATCH 02/16] data: Be explicit in data_db check X-BeenThere: bitbake-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussion that advance bitbake development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 21:54:00 -0000 The if statement current causes the size of parent to be calcuated which is like a len() operation on a datastore. Since we're only interested whether the value is none, checking explictly for this gives a small performance gain. Signed-off-by: Richard Purdie --- lib/bb/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bb/data.py b/lib/bb/data.py index 8c9cb0f..e6d5232 100644 --- a/lib/bb/data.py +++ b/lib/bb/data.py @@ -59,7 +59,7 @@ def init(): def init_db(parent = None): """Return a new object representing the Bitbake data, optionally based on an existing object""" - if parent: + if parent is not None: return parent.createCopy() else: return _dict_type() -- 1.8.1.2