[MIC] tel-plugin-databases: Speed up SQLite3 insertion operations while running MIC... 41/129541/2
authorGeunsik Lim <geunsik.lim@samsung.com>
Wed, 17 May 2017 01:36:43 +0000 (10:36 +0900)
committersinikang <sinikang@samsung.com>
Wed, 17 May 2017 07:06:18 +0000 (16:06 +0900)
commit6d10f3fa4f7fc892e848b52458a2fc4938d56d20
tree5ac2e661e281b3fcfe9132bdc02d9183a395eacd
parent80ff82b7420931ad1d91cc203d6b2303793808aa
[MIC] tel-plugin-databases: Speed up SQLite3 insertion operations while running MIC command

This commit is to speed up exeuction time of a MIC operation.

The "INSERT INTO ..." operation has been taken more than 500 milli seconds
when we run MIC command to make a Tizen platform image on the below system environment.
 - CPU: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
 - Memory: DDR3 8GiB
 - OS: Ubuntu 14.04.5 LTS

We don't need to keep the synchronous operation in case that we only
run insertion commands without any data modification such as MODIFY
and DELETE statement.

@To maintainer:
----------------
First, Note that  the number of  insertion commands results in more synchronization
cost in kernel space. For example, the more we call a write(2) syscall,
the more  Linux kernel calls submit_bio(9) and futex_wait(9) kernel function.
Disabling a synchronous operation will cause SQLite3 to not wait on data to
reach the disk surface, which will make write operations appear to be much
faster.

Second, Note that you have to check frequently if the version of SQLite3 is state-of-the-art.
As we all know, the existing bugs is often fixed in the latest version of SQLite3.

@Evaluation:
----------------
 - How to do unit-test:
   $ cd ./tel-plugin-databases
   $ time sqlite3 ./mybenchmark.db < ../cdma_mcc_sid_list.sql

 - Before this patch:
real 0m0.553s
user 0m0.019s
sys 0m0.013s

 - After this patch:
real 0m0.029s
user 0m0.020s
sys 0m0.009s

@Reference:
----------------
 - Pragma statements supported by SQLite, https://www.sqlite.org/pragma.html

Change-Id: I0f3c7c36bd768722fa649e1bc2f4236dcebe9e71
Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
packaging/tel-plugin-database.spec
res/cdma_mcc_sid_list.sql
res/common_mcc_mnc_oper_list.sql