[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

sprezzos apt-show-rewrite complete (report + numbers)



This is a followup to my post to debian-devel, debian-derivatives, deity,
and sprezzos-dev last Monday entitled "apt-show-versions rewrite". This
post is strictly informative, and does not advocate any policy.

Documentation has been substantially embeefened, including design notes:

 https://www.sprezzatech.com/wiki/index.php/Raptorial 
 https://github.com/dankamongmen/raptorial

rapt-show-versions(1), part of the RAPTORIAL suite, has become
feature-equivalent to the native apt-show-versions(1) tool, as predicted.
Despite fleshing out the features, I've managed to retain its speed.

 [recombinator](0) $ ./rapt-show-versions  -h
 rapt-show-versions v0.1.5 by nick black <dank@qemfd.net>
  invoked as /home/dank/raptorial/.libs/lt-rapt-show-versions

 usage: rapt-show-versions [ options ] packageregex
 options:
  -s|--status-file=<file> Status file (def: /var/lib/dpkg/status)
  -l|--list-dir=<dir>     List directory (def: /var/lib/apt/lists)
  -a|--allversions        Print all available versions
  -h|--help               Display this usage summary
 [recombinator](0) $ 

Anyone who was offended by discussion "without the code written" last
week ought hopefully be able to join in without bias now. The entirety of
the codebase, including the common libraptorial(3) library, is 1650 lines
of heavily-commented POSIX C:

 [recombinator](0) $ wc -l  src/bin/rapt-show-versions.c src/lib/*[ch]
   217 src/bin/rapt-show-versions.c
   233 src/lib/aac.c
    31 src/lib/aac.h
    96 src/lib/config.h
   898 src/lib/packages.c
    12 src/lib/paths.c
   163 src/lib/raptorial.h
  1650 total
 [recombinator](0) $ 

All modes of apt-show-versions have been implemented:

 - print packages from command line arguments, and status/upgrade info
 - print all installed package, and status/upgrade info
 - print all package versions using either of these two modes

And now, the timings.... [drumroll]....

I am testing on two machines, a Core i7 2600K quadcore with HyperThreading,
overclocked to 5.0GHz ("skynet"), and a Core 2 Duo 6600 at stock 2.4GHz
("recombinator"). I ran each mode 10 times with each binary on each machine,
without interleaving. As the working set of each binary can be kept easily
within page cache on either machine, these tests probably do not reflect true
disk i/o. Disk I/O would be expected to only help RAPTORIAL relative to 
apt-show-versions, given that RAPTORIAL will issue its disk reads in parallel,
rather than sequentially, and that they can all fit in page cache. These tests
use RAPTORIAL 0.1.5, Libblossom 1.2.2, and the native SprezzOS APT databases of
the machines.

Case 1: Print selected packages and status/upgrade info

 Quadcore:

 [skynet](0) $ for i in `seq 1 10` ; do /usr/bin/time -f "%ems real %Ums user %P util" ./rapt-show-versions apt raptorial > /dev/null ; done
 0.09ms real 0.21ms user 234% util
 0.10ms real 0.22ms user 245% util
 0.11ms real 0.22ms user 227% util
 0.10ms real 0.23ms user 242% util
 0.10ms real 0.22ms user 249% util
 0.11ms real 0.24ms user 225% util
 0.14ms real 0.30ms user 230% util
 0.11ms real 0.24ms user 233% util
 0.10ms real 0.25ms user 250% util
 0.13ms real 0.29ms user 238% util
 [skynet](0) $ for i in `seq 1 10` ; do /usr/bin/time -f "%ems real %Ums user %P util" apt-show-versions apt raptorial > /dev/null ; done
 0.36ms real 0.32ms user 97% util
 0.35ms real 0.32ms user 98% util
 0.35ms real 0.34ms user 98% util
 0.36ms real 0.34ms user 97% util
 0.36ms real 0.33ms user 97% util
 0.35ms real 0.33ms user 97% util
 0.37ms real 0.34ms user 97% util
 0.35ms real 0.31ms user 97% util
 0.36ms real 0.34ms user 97% util
 0.35ms real 0.33ms user 98% util
 [skynet](0) $ 

 Dualcore:

 [recombinator](0) $ for i in `seq 1 10` ; do /usr/bin/time -f "%es real %Us user %P util" apt-show-versions apt raptorial > /dev/null ; done
 0.52s real 0.48s user 98% util
 0.52s real 0.42s user 97% util
 0.52s real 0.46s user 97% util
 0.52s real 0.44s user 97% util
 0.52s real 0.46s user 97% util
 0.52s real 0.46s user 97% util
 0.52s real 0.48s user 97% util
 0.51s real 0.45s user 98% util
 0.52s real 0.50s user 97% util
 0.52s real 0.44s user 97% util
 [recombinator](0) $ for i in `seq 1 10` ; do /usr/bin/time -f "%es real %Us user %P util" ./rapt-show-versions apt raptorial > /dev/null ; done
 0.16s real 0.26s user 164% util
 0.15s real 0.26s user 165% util
 0.15s real 0.24s user 164% util
 0.15s real 0.24s user 165% util
 0.15s real 0.24s user 165% util
 0.14s real 0.24s user 174% util
 0.14s real 0.25s user 175% util
 0.16s real 0.26s user 159% util
 0.15s real 0.25s user 169% util
 0.15s real 0.24s user 163% util
 [recombinator](0) $ 

**** Call it 13ms vs 36ms on the quadcore and 15ms vs 51ms on the dualcore.
**** Quadcore winner: RAPTORIAL at 36% running time
**** Dualcore winner: RAPTORIAL at 29% running time
**** Champion: RAPTORIAL

Case 2: Print all installed packages and status/upgrade info

 Quadcore:

 [skynet](0) $ for i in `seq 1 10` ; do /usr/bin/time -f "%es real %Us user %P util"  apt-show-versions > /dev/null ; done
 1.17s real 1.13s user 99% util
 1.18s real 1.14s user 98% util
 1.17s real 1.12s user 99% util
 1.17s real 1.14s user 98% util
 1.16s real 1.13s user 99% util
 1.17s real 1.15s user 99% util
 1.18s real 1.14s user 98% util
 1.17s real 1.13s user 99% util
 1.17s real 1.12s user 98% util
 1.18s real 1.15s user 99% util
 [skynet](0) $ for i in `seq 1 10` ; do /usr/bin/time -f "%es real %Us user %P util" ./rapt-show-versions > /dev/null ; done
 0.12s real 0.25s user 223% util
 0.11s real 0.24s user 226% util
 0.13s real 0.28s user 238% util
 0.13s real 0.26s user 225% util
 0.14s real 0.31s user 232% util
 0.12s real 0.27s user 250% util
 0.12s real 0.25s user 222% util
 0.12s real 0.24s user 229% util
 0.12s real 0.28s user 245% util
 0.12s real 0.25s user 225% util
 [skynet](0) $ 

 Dualcore:

 [recombinator](0) $ for i in `seq 1 10` ; do /usr/bin/time -f "%es real %Us user %P util" ./rapt-show-versions > /dev/null ; done
 0.17s real 0.29s user 174% util
 0.15s real 0.26s user 173% util
 0.15s real 0.27s user 178% util
 0.16s real 0.27s user 175% util
 0.16s real 0.26s user 173% util
 0.15s real 0.24s user 169% util
 0.15s real 0.26s user 181% util
 0.16s real 0.25s user 165% util
 0.16s real 0.28s user 168% util
 0.15s real 0.28s user 178% util
 [recombinator](0) $ for i in `seq 1 10` ; do /usr/bin/time -f "%es real %Us user %P util" apt-show-versions > /dev/null ; done
 1.13s real 1.05s user 98% util
 1.13s real 1.08s user 98% util
 1.12s real 1.07s user 99% util
 1.12s real 1.06s user 99% util
 1.13s real 1.06s user 98% util
 1.12s real 1.07s user 98% util
 1.12s real 1.06s user 99% util
 1.12s real 1.06s user 98% util
 1.12s real 1.05s user 98% util
 1.13s real 1.08s user 98% util
 [recombinator](0) $ 

Pretty constant performance from both. Let's call it 1.17s vs .13s on the
quadcore and 1.12s vs .16s on the dualcore (this perhaps surprising result
can be explained by the fact that there are fewer packages installed on the
dualcore).

**** Quadcore winner: RAPTORIAL at 11% running time
**** Dualcore winner: RAPTORIAL at 11% running time
**** Champion: RAPTORIAL with a ~90% reduction in time

Oh btw, if you don't take it to /dev/null, RAPTORIAL beats apt-show-versions
by several seconds. It is absolutely faster across the board.

Gentlemen, you claimed that you could "whip up a C++ apt-show-versions" and
get similar performance. Consider the gauntlet thrown, and the mic dropped.
I look forward to your results.

                            [silence on the dropped mic]

--Rigorously, Nick Black
  Hacker-in-Charge, SprezzOS Project

PS RAPTORIAL and libblossom packages, both binary and source, can be downloaded
from the SprezzOS APT repositories, or the source can be had from github.


-- 
nick black     http://www.sprezzatech.com -- unix and hpc consulting
to make an apple pie from scratch, you need first invent a universe.

Attachment: signature.asc
Description: Digital signature


Reply to: