summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds
diff options
context:
space:
mode:
authorBobCF <bob.c.feng@intel.com>2018-11-09 15:41:02 +0800
committerBobCF <bob.c.feng@intel.com>2018-12-07 10:23:07 +0800
commit2f818ed0fb57d98985d151781a2ce9b8683129ee (patch)
treef0d8febdd770253e96aa59cb6032a4ef9364d5c1 /BaseTools/Source/Python/GenFds
parentb3497bad1221704a5dbc5da0b10f42625f1ad2ed (diff)
downloadedk2-2f818ed0fb57d98985d151781a2ce9b8683129ee.tar.gz
edk2-2f818ed0fb57d98985d151781a2ce9b8683129ee.tar.bz2
edk2-2f818ed0fb57d98985d151781a2ce9b8683129ee.zip
BaseTools: Replace the sqlite database with list
https://bugzilla.tianocore.org/show_bug.cgi?id=1288 [V2] Optimize this patch so that it can be easy to review. This patch is just apply the change to original files while not create new similar files. [V1] This patch is one of build tool performance improvement series patches. This patch is going to use python list to store the parser data instead of using sqlite database. The replacement solution is as below: SQL insert: list.append() SQL select: list comprehension. for example: Select * from table where field = “something” -> [ item for item in table if item[3] == “something”] SQL update: python map function. for example: Update table set field1=newvalue where filed2 = “something”. -> map(lambda x: x[1] = newvalue, [item for item in table if item[2] == “something”]) SQL delete: list comprehension. With this change, We can save the time of interpreting SQL statement and the time of write database to file system Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: BobCF <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds')
-rw-r--r--BaseTools/Source/Python/GenFds/GenFds.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index da484d0bb1..51655cc09c 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -226,12 +226,11 @@ def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
"""call Workspace build create database"""
GlobalData.gDatabasePath = os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))
+
if WorkSpaceDataBase:
BuildWorkSpace = WorkSpaceDataBase
else:
- BuildWorkSpace = WorkspaceDatabase(GlobalData.gDatabasePath)
- BuildWorkSpace.InitDatabase()
-
+ BuildWorkSpace = WorkspaceDatabase()
#
# Get files real name in workspace dir
#