Top «Prev(2005-09-04) Latest Next(2005-09-20)» Edit

pterjan's diary


2005-09-14

  How can rpm -qa be so slow ?

rpm -qa is about 20 times slower than the same search in ruby, even if I enforce the search on name.
When I search a particular rpm using its name, the time is the same with rpm -q and ruby version. In fact, I didn't find any case when the C version is faster than the ruby one !
I really can't understand how the binding code can be faster than the official C rpm software...
[root@plop tmp]# time ruby -rrpm -e 'RPM::DB.new.each{ |p| puts "#{p.name}-#{p.version}"}' > ra
0.27user 0.08system 0:00.44elapsed 82%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+7219minor)pagefaults 0swaps
[root@plop tmp] # time rpm -qa > rb 7.14user 0.07system 0:07.48elapsed 96%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+4543minor)pagefaults 0swaps
[root@plop tmp] # time ruby -rrpm -e 'RPM::DB.new.each_match(RPM::TAG_NAME,nil){ |p| puts "#{p.name}-#{p.version}"}' > rc 0.29user 0.06system 0:00.44elapsed 81%CPU (0avgtext+0avgdata 0maxresident)k
[root@plop tmp]# diff ra rb [root@plop tmp]# diff ra rc [root@plop tmp]#
[root@plop tmp]# time ruby -rrpm -e 'RPM::DB.new.each_match(RPM::TAG_NAME,"rpm"){ |p| puts "#{p.name}-#{p.version}"}'
rpm-4.4.1-10mdk
0.03user 0.00system 0:00.10elapsed 34%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1319minor)pagefaults 0swaps
[root@plop tmp] # time ruby -rrpm -e 'RPM::DB.new.each_match(RPM::DBI_LABEL,"rpm"){ |p| puts "#{p.name}-#{p.version}"}' rpm-4.4.1-10mdk 0.03user 0.00system 0:00.10elapsed 34%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+1321minor)pagefaults 0swaps
[root@plop tmp] # time rpm -q rpm rpm-4.4.1-10mdk 0.03user 0.00system 0:00.10elapsed 36%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+1630minor)pagefaults 0swaps
[root@plop tmp]# time ruby -rrpm -e 'RPM::DB.new.each_match(RPM::TAG_BASENAMES, "/bin/sh"){ |p| puts "#{p.name}-#{p.version}"}'
bash-3.0-6mdk
0.04user 0.00system 0:00.11elapsed 42%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2029minor)pagefaults 0swaps
[root@plop tmp] # time rpm -qf /bin/sh bash-3.0-6mdk 0.04user 0.00system 0:00.12elapsed 42%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+2311minor)pagefaults 0swaps
[root@plop tmp]# time ruby -rrpm -e 'RPM::DB.new.each_match(RPM::TAG_NAME,"rpm"){ |p| puts p.sprintf("[%{RequireName} %{RequireFlags:depflags} %{RequireVersion}\n]")}' > ra
0.03user 0.00system 0:00.10elapsed 34%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1288minor)pagefaults 0swaps
[root@plop tmp] # time rpm -q --requires rpm > rb 0.03user 0.00system 0:00.11elapsed 36%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+1610minor)pagefaults 0swaps
[root@plop tmp] # diff ra rb [root@plop tmp]#
[root@plop tmp]# time ruby -rrpm -e 'RPM::DB.new.each_match(RPM::TAG_REQUIRENAME,"rpm"){ |p| puts "#{p.name}-#{p.version}"}'
basesystem-10.1-1mdk
menu-2.1.23-1mdk
cups-common-1.1.23-11mdk
rpm-python-4.4.1-10mdk
rpm-build-4.4.1-10mdk
perl-URPM-1.24-1mdk
rpmtools-5.0.21-1mdk
0.03user 0.00system 0:00.11elapsed 33%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1431minor)pagefaults 0swaps
[root@plop tmp] # time rpm -q --whatrequires rpm basesystem-10.1-1mdk menu-2.1.23-1mdk cups-common-1.1.23-11mdk rpm-python-4.4.1-10mdk rpm-build-4.4.1-10mdk perl-URPM-1.24-1mdk rpmtools-5.0.21-1mdk 0.07user 0.00system 0:00.16elapsed 48%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+1673minor)pagefaults 0swaps
Today's TSUKKOMI(Total: 17) [Add a TSUKKOMI]
  Joseph Cheek (2005-09-15 16:11)

I have noticed that rpm -qa is very slow on 2006 Cooker. It wasn't the case on Desktop/LX, but that is a lot of different software. But yes, rpm -qa is abnormally slow.

  Per Øyvind Karlsen (2007-02-04 03:45)

Laaaaaaaaaate reply, but I believe here's why:<br>[hawkeye@terror ~]$ time rpm -qa --nosignature --nodigest > tmp/rpm.rpm<br>0.75user 0.27system 0:01.09elapsed 93%CPU (0avgtext+0avgdata 0maxresident)k<br>0inputs+0outputs (0major+2845minor)pagefaults 0swaps<br>[hawkeye@terror ~]$ time ruby -rrpm -e 'RPM::DB.new.each{ |p| puts "#{p.name}-#{p.version}"}' > tmp/ruby.rpm<br>0.80user 0.30system 0:01.18elapsed 93%CPU (0avgtext+0avgdata 0maxresident)k<br>0inputs+0outputs (0major+5090minor)pagefaults 0swaps<br><br>I believe ruby doesn't verify digest nor signature by default?

  pterjan (2007-02-04 10:39)

Yes, it only queries the database as you can see in the simple code :) See http://fasmz.org/~pterjan/blog/?date=20051208

  linkpyramid (2014-04-07 08:49)

Thanks a lot for the article post.Much thanks again. Fantastic. <br> <a href="http://fiverr.com/uptotop">google linkwheel</a>

  fake text messaging (2014-04-11 21:19)

I cannot thank you enough for the post.Really looking forward to read more. Fantastic. <br> <a href="http://www.slideshare.net/lesterdiaz/blow-up-my-phone">fake text messages</a> <br>

  meilleur logiciel de facturation (2014-04-15 16:19)

Thanks so much for the blog post.Really thank you! Awesome. <br> <a href="http://www.go-facture.fr/">logiciel de facturation</a> <br>

  scott sohr lawsuit (2014-04-19 22:58)

Im obliged for the blog.Much thanks again. Great. <br> <a href="http://www.bizjournals.com/nashville/news/2012/03/14/nashville-developer-scott-sohr-slapped.html">scott sohr lawsuit</a> <br>

  NHL (2014-04-25 14:58)

Really appreciate you sharing this post. <br> <a href="http://www.sportfantalk.com/">NHL</a> <br>

  nhà di động (2014-04-28 16:58)

Im thankful for the blog article.Thanks Again. Really Great. <br> <a href="http://www.longquyen.info/">thép v lỗ</a> <br>

  mbt shoes clearance (2014-05-01 01:17)

mbt shoes belgium pterjan's diary(2005-09-14) <br>[url=http://ugconstruction.co.in/mbt-shoes-online/2010-mbt-shoes-clearance-with-a-low-price.asp]mbt shoes clearance[/url]

  discount mbt shoes (2014-05-01 05:42)

mbt shoes sizing pterjan's diary(2005-09-14) <br>discount mbt shoes http://proinfocus.com/mbt-shoes-online/women-s-mbt-shoes-lawsuit-men-s-mbt-shoes.asp

  mbt shoes cheap (2014-05-01 22:26)

mbt shoes sale john lewis pterjan's diary(2005-09-14) <br>mbt shoes cheap http://pes.nutanvidyalaya.org/mbt-shoes-online/mbt-outlet-stores-uk-mbt-shoes-cheap-6552.asp

  australia hermes (2014-05-02 04:59)

hermes paket gr??e pterjan's diary(2005-09-14) <br>australia hermes http://raufsal.com/hermes-bags/australia-hermes-hermes-rostock-749.asp

  mbt walking shoes (2014-05-03 00:43)

genuine mbt shoes uk pterjan's diary(2005-09-14) <br>mbt walking shoes http://codebiz.in/mbt-shoes-sale/mbt-shoes-nyc-your-very-best-self-health-partner.asp

  mbt shoes india (2014-05-04 16:07)

mbt shoes chicago pterjan's diary(2005-09-14) <br>mbt shoes india http://mrmc.hkesociety.org/mbt-shoes-outlet/online-shopping-for-mbt-shoes-india-with-free-shipping.asp

  replica watch (2014-05-04 18:09)

Best replica watches with genuine Swiss movement for sale <br>replica watch http://www.aiwatch.in

  creative ideas (2014-05-05 17:01)

Great article post.Really looking forward to read more. Keep writing. <br> <a href="http://www.premed.fudan.edu.cn/premedforum/user/profile/205197.page">cool gadgets</a> <br>


2004|06|07|08|09|11|
2005|01|02|05|06|07|08|09|10|11|12|
2006|01|02|03|06|08|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|12|
2011|02|04|06|
2012|01|05|11|
2013|01|02|04|06|
2014|02|
2015|06|
2017|05|07|12|