Don't use Scanf()

Eddie Wyatt edw at IUS1.CS.CMU.EDU
Mon Mar 14 04:36:07 AEST 1988


In article <2057 at svax.cs.cornell.edu>, belmonte at svax.cs.cornell.edu (Matthew Belmonte) writes:
> 
> Imagine again.  The generated code will be a push of the address of the argument

> But this doesn't alter the fact that
> IT JUST DOESN'T MAKE ENOUGH DIFFERENCE FOR THE PROGRAMMER TO CARE.  printf and
> puts are both linear-time algorithms.  printf probably takes a little longer
> because it has to check for embedded format strings, but it doesn't find any in
> this case, so the extra time is negligible.

   I've tried staying out of this STUPID conversation but .....

   It all depends.  One of the routines I've written was a database
dump facility.  The object was to dump the entire contents of the
database in some human readable format and later to be able to
parse the dump file and reload the database.  Anyway, I was
looking for ways to decrease the dump time and one of the things
I did was to replace calls to fprintf on unformatted strings with calls
to a routine that printed just a string using putc.  In doing this I was
able to get about a 20% increase in speed.  Not too much, but for what
took all of an hour to do, I would say a reasonable investment.

  In general however your comments stands.  


BTW: Dicky Moe, if you don't want people replying to your articles,
don't bother posting them on the net.  Followups to /dev/null annoys the hell
out of me!


-- 

Eddie Wyatt 				e-mail: edw at ius1.cs.cmu.edu



More information about the Comp.lang.c mailing list