On Tue, Mar 19, 2002 at 02:00:40PM +0100, Guillaume Cottenceau wrote:
> With a -t it gives to me:
> 
> [gc@bi ~] time rpmmon -p xmms
> gc
> 0.13user 0.01system 0:00.24elapsed 57%CPU (0avgtext+0avgdata 0maxresident)k
> 0inputs+0outputs (352major+448minor)pagefaults 0swaps

Exact same test here (on a different machine than I posted earlier with
but that doesn't really matter).

[breser@titanium utils]$ time ./rpmmon.pl -p xmms -t maints
gc
1.23user 0.64system 0:04.03elapsed 46%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (1240major+675minor)pagefaults 0swaps

Same test with the code in my CGI script.  On the same machine as above.
0.27user 0.00system 0:00.42elapsed 63%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (436major+322minor)pagefaults 0swaps

That's 9 times faster.  Now maybe on a tool when you're running it by
hand on a command line you don't care that you have to wait.  But when
you shove it on a webserver and make it accessible to the world speed is
the difference between and overwhelmed server and one that runs nicely.

At any rate I thought I saw why there is the difference.  You allow people
to query multiple packages by separating them with a comma.  To support
this you load the entire list of packages and maintainers into a hash.
This takes a little bit of time and isn't very efficent when you only
want one entry.

What I did is only allow for one package.  I open the file and search
for the result when I find it I quit.

So I tried to graft a modified version of this into rpmmon.pl.  No
speedup in time.  So I'm really not sure what's slowing it down.  But it
has to do with the code that is run from package_maintainer because if I
comment all the calls there it ruturns quickly.  In other words I've
eliminated the other overhead of the program (including perl
compilation) as the problem.

> It's nice that you provide a cgi way to have maintainers but I
> don't see what I can do with your code.

Ohh I wasn't really suggesting that you do anything with it.  I was
providing it so if you wanted to see how I'd done it and was getting
different results as far as execution speed.

Anyway I've got other things to work on at the moment as I'm sure you do
so I'll table this for now.  Maybe when I get a chance I'll come back
and look at this.

-- 
Ben Reser <[EMAIL PROTECTED]>
http://ben.reser.org

What difference does it make to the dead, the orphans, and the homeless,
whether the mad destruction is wrought under the name of totalitarianism
or the holy name of liberty and democracy? - Ghandi

Reply via email to