]> code.ossystems Code Review - openembedded-core.git/commit
build-compare: make pkg-diff.sh 75% faster
authorRobert Yang <liezhi.yang@windriver.com>
Mon, 18 Jul 2016 03:32:43 +0000 (20:32 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 25 Jul 2016 22:46:59 +0000 (23:46 +0100)
commit71eee4adbcda1d9e75cbce58045d03ea12432431
tree77abe0a7905aa31af1a23169d0709e5246e7895f
parent79c574979f64f2dbe8ca05774446de21a53b3a87
build-compare: make pkg-diff.sh 75% faster

The rpm tool is a heavy process, pkg-diff.sh ran 16 (or 17 for kernel)
"rpm -qp" times when the pkgs are identical, now we only run
"rpm -qp --qf <all we need>" twice (one is for old pkg, and one is for
new), save the results to spec_old and spec_new, then use sed command to
get what we need later, this can make it 75% faster when the pkgs are
identical. Here is the rough data on my host Ubuntu 14.04.4, 32 cores
CPU and 128G mem:
* When the pkgs are identical:
  - Before the patch: 1s
  - After the patch: 0.26s
  I compare the whole spec firstly, and return 0 if they are the same,
  or go on checking one by one if not, without this, it would be 0.46s,
  the gain is great when there are lot of packages, usually, we have
  more than 10,000 rpms to compare.

* When the pkgs are different:
  That depends on where is the different, if the different is at the
  comparing rpmtags stage:
  - Before the patch: 0.26s
  - After the patch: 0.29s
  Increased 0.03s, but if the different is happend later than comparing
  rpmtags, it will save time.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-devtools/build-compare/build-compare_git.bb
meta/recipes-devtools/build-compare/files/functions.sh-run-rpm-once-to-make-it-faster.patch [new file with mode: 0644]