{"id":9,"date":"2006-07-30T23:31:26","date_gmt":"2006-07-30T23:31:26","guid":{"rendered":"http:\/\/robert.vanyi.org\/?p=9"},"modified":"2006-07-30T23:31:26","modified_gmt":"2006-07-30T23:31:26","slug":"9","status":"publish","type":"post","link":"https:\/\/robert.vanyi.org\/en\/archives\/9","title":{"rendered":"Speeding up dpkg"},"content":{"rendered":"<p>I always had problems with the speed and memory consumption of dpkg. When I&#8217;m doing apt-get upgrade, my laptop becomes unusable for several minutes. And I do it every day, since I&#8217;m using debian testing. I made a little research, and found out that a huge part of the time is spent in the <code>parsedb<\/code> function with parsing the text files containing package information. That&#8217;s when you see <code>\"(Reading database ...\"<\/code><\/p>\n<p>Therefore I decided to replace the textfile backend with sqlite3. The first step is almost finished: the package information has been imported into an sqlite database. I just wrote a 100 line C++ prog, and it works. <\/p>\n<p>The preliminary results are self explanatory:<br \/>\n<!--break--><br \/>\nUsing dpkg as it is now (file backend, 17782 packages):<br \/>\n<code><br \/>\n<strong>hikaru:\/home\/robi\/prog\/dpkg\/trunk\/utils# time dpkg -l \"gnome-terminal\"<\/strong><\/p>\n<p>[...]<br \/>\nii  gnome-terminal                     2.14.2-1                           The GNOME 2 terminal emulator application<br \/>\n[...]<br \/>\nreal    0m6.817s<br \/>\nuser    0m1.360s<br \/>\nsys     0m0.092s<br \/>\n<\/code><\/p>\n<p>Using an sql query with sqlite (same database, 17782 packages):<br \/>\n<code><br \/>\n<strong>hikaru:\/home\/robi\/prog\/dpkg\/trunk\/utils# time echo \"SELECT * FROM packages WHERE Package='gnome-terminal';\" | sqlite3 available.db<\/strong><br \/>\ngnome-terminal|optional|gnome|404|Guilherme de S. Pastore <gpastore@debian.org>|i386||2.14.2-1|b18bd66347ef25707e7b92957142de0b<br \/>\n[...]<br \/>\nreal    0m0.851s<br \/>\nuser    0m0.004s<br \/>\nsys     0m0.004s<br \/>\n<\/code><\/p>\n<p>The next step is to fix some bugs (eg. having &#8216; in the descriptions is a problem at the moment), and then replace the code in <code>parsedb<\/code>. But first I have to get some sleep.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I always had problems with the speed and memory consumption of dpkg. When I&#8217;m doing apt-get upgrade, my laptop becomes unusable for several minutes. And I do it every day, since I&#8217;m using debian testing. I made a little research, and found out that a huge part of the time is spent in the parsedb &hellip; <a href=\"https:\/\/robert.vanyi.org\/en\/archives\/9\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Speeding up dpkg<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-9","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/posts\/9","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/comments?post=9"}],"version-history":[{"count":0,"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/posts\/9\/revisions"}],"wp:attachment":[{"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/media?parent=9"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/categories?post=9"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/tags?post=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}