From: Chrysalis <cellis@iol.ie>
Subject: Re: Cost of leaving debug statements in code
Date: 1997/06/06
Message-ID: <3397E857.578E@iol.ie>#1/1
References: <33962b81.0@news.isd.net> <3396DC00.4DA@att.com>
Organization: None
Reply-To: cellis@iol.ie
Newsgroups: comp.databases.oracle.misc



I didn't know the answer, either, so I ran a test to try to determine
the cost of evaluating a simple boolean test: results below (in seconds
on a Mac PowerBook with Oracle V7.1.4).

To indulge in a "raging debate" seems unnecessary.

Chrysalis.

SQL> timing start BASE
SQL> declare
  2  	bool boolean := TRUE;
  3  begin
  4  	for i in 0 .. 9999999	     -- 10^7
  5  	loop
  6  	   null;
  7  	end loop;
  8  end;
  9  /
SQL> timing stop;
timing for: BASE
 real: 56
SQL> 
SQL> timing start BOOL_TEST
SQL> declare
  2  	bool boolean := TRUE;
  3  begin
  4  	for i in 0 .. 9999999	     -- 10^7
  5  	loop
  6  	   if bool then
  7  	      null;
  8  	   end if;
  9  	end loop;
 10  end;
 11  /
SQL> timing stop;
timing for: BOOL_TEST
 real: 81



Allen Kirby wrote:
> 
> Mark Everhart wrote:
> >
> > Debate raging in current organization about the cost vs benefit of leaving
> > debug output statements in production code.  Currently, a private Boolean
> > variable can be set On or Off by using public procedures.  This variable is
> > evaluated and if True then a debug package is called to output values of
> > variables or whatever.
> >
> > The argument rages over the cost of evaluating the Boolean variable at
> > numerous places in the code.  Obviously, the poor souls manning the beepers
> > would like to have the option of re-running a production job that goes down
> > with the debug set on, so they can evaulate more accurately the cause of a
> > problem, fix it, and go back to sleep or whatever.
> 
> The only way to resolve the debate is to run a load test, measuring
> system resources and response time, with the debug compiled in but
> turned off and with the debug not compiled in, and compare the results.
> Nobody can argue with that type of test.  Personally, I would leave it
> in if at all possible.
> --
> ---
> Allen Kirby                     AT&T ITS Production Services
> akirby@att.com                  Alpharetta, GA.


