From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 279E821107194 for ; Thu, 30 Aug 2018 06:07:59 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2018 06:07:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="81529974" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga002.fm.intel.com with ESMTP; 30 Aug 2018 06:07:58 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 30 Aug 2018 06:07:58 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.240]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.185]) with mapi id 14.03.0319.002; Thu, 30 Aug 2018 21:07:56 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH v1 1/1] BaseTools: minimize assignment processing Thread-Index: AQHUPyGz4knU+Xx+M0KRfttlCB2yOaTYRpvg Date: Thu, 30 Aug 2018 13:07:56 +0000 Message-ID: References: <607c9894109c83f3d3d2d2c64136075ff0bb91b0.1535496617.git.jaben.carsey@intel.com> In-Reply-To: <607c9894109c83f3d3d2d2c64136075ff0bb91b0.1535496617.git.jaben.carsey@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v1 1/1] BaseTools: minimize assignment processing X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2018 13:07:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Wednesday, August 29, 2018 6:51 AM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong ; Gao, Liming Subject: [PATCH v1 1/1] BaseTools: minimize assignment processing Reverse the checking and only assign once to each variable. Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Workspace/DscBuildData.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 748452623fd3..e4f5cba156c5 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1534,15 +1534,16 @@ class DscBuildData(PlatformBuildClassObject): PcdValueDict[PcdCName, TokenSpaceGuid] =3D {SkuName:(PcdVa= lue, DatumType, MaxDatumSize)} =20 for ((PcdCName, TokenSpaceGuid), PcdSetting) in PcdValueDict.iteri= tems(): - PcdValue =3D None - DatumType =3D None - MaxDatumSize =3D None - if TAB_COMMON in PcdSetting: - PcdValue, DatumType, MaxDatumSize =3D PcdSetting[TAB_COMMO= N] - if TAB_DEFAULT in PcdSetting: - PcdValue, DatumType, MaxDatumSize =3D PcdSetting[TAB_DEFAU= LT] if self.SkuIdMgr.SystemSkuId in PcdSetting: PcdValue, DatumType, MaxDatumSize =3D PcdSetting[self.SkuI= dMgr.SystemSkuId] + elif TAB_DEFAULT in PcdSetting: + PcdValue, DatumType, MaxDatumSize =3D PcdSetting[TAB_DEFAU= LT] + elif TAB_COMMON in PcdSetting: + PcdValue, DatumType, MaxDatumSize =3D PcdSetting[TAB_COMMO= N] + else: + PcdValue =3D None + DatumType =3D None + MaxDatumSize =3D None =20 Pcds[PcdCName, TokenSpaceGuid] =3D PcdClassObject( PcdCName, --=20 2.16.2.windows.1