elusion has asked for the wisdom of the Perl Monks concerning the following question:

I've been benchmarking some of my code, but unfortunately, I don't know what all the values mean. I've looked in the benchmark docs for explanations, but it only explains cpu time. What do usr and sys time mean, and what are "good times" for a cgi script, or other scripts for the matter?

- p u n k k i d
"Reality is merely an illusion, albeit a very persistent one." -Albert Einstein

Replies are listed 'Best First'.
Re: Benchmark - the meaning
by merlyn (Sage) on Dec 25, 2000 at 07:44 UTC
    Realwallclock time
    Useramount of CPU time the program spends in your code (Perl execution)
    Sysamount of CPU time the program spends handling system calls for you

    -- Randal L. Schwartz, Perl hacker

Re: Benchmark - the meaning
by eg (Friar) on Dec 25, 2000 at 12:00 UTC

    This has nothing to do with perl per se, but according to Jakob Neilson in Designing Web Usability, a response that's less than 0.1 second long is seen as instantaneous to the user. This would be ideal as there's no disruption to the user's navigation. A response time of one second is noticable to the user, but still, there is little disruption to them. A response time of ten seconds is very noticable to the user and disrupts navigation (i.e. it's seen as an actual pause), but it's still within the bounds of a person's ordinary patience. Anything more than ten seconds, Neilson says, and you risk frustrating the user. This is just a rough guideline.

    Personally, I suspect Neilson (or the studies that Neilson quotes) are a bit pessimistic. I think by now people are pretty well trained to wait a bit longer for their web pages to show up.

    So, to answer your question, if you can bring up your web page within about ten seconds (including the time it takes to travel across the network, on a server with average to moderately high load), then I think you're doing okay.

    By the way, although Benchmark is good for optimising, you might want to look into Devel::DProf (or Apache::DProf if you're using mod_perl) which will help you track down where your code is spending its time.

Re: Benchmark - the meaning
by extremely (Priest) on Dec 25, 2000 at 06:38 UTC
    Good times for a CGI script are completely up to the task and the expected load. Are you planning to have it hit multiple times a second? Well then, the total time to execute should be less than a fraction of a second or so. If it will only get hit occasionally or if the scripts don't contend heavily for system resources but just wait on external resources, they can take more time overall.

    In most cases, Benchmark is better at testing two pieces of code to determine which is the most efficient. Throwing it at a single piece of code is trickier.

    --
    $you = new YOU;
    honk() if $you->love(perl)