From: walker@twix.unx.sas.com (Doug Walker)
Subject: Re: AmigaDOS vs. ANSI SAS implementation [Was Re: SAS C6.1 datecmp bug]
Originator: walker@twix.unx.sas.com
Date: Tue, 29 Dec 1992 18:58:53 GMT
Organization: SAS Institute Inc.


In article <DMAK.92Dec25000536@dec5120a.ccs.northeastern.edu>, dmak@dworkin.ccs.northeastern.edu (Dave Mak) writes:
|> Some people seem to be getting difftime and datecmp (two different functions)
|> confused, but this leads me to another question:
|> 
|> Forgive me if this shows off my ignorance in compiler design, but I'm curious
|> as to which routines are better performance wise.  AmigaDOS or their ANSI
|> equivalents?  Case in point: ANSI time routines vs. AmigaDOS stuff.  Is it a
|> simple programmer preference (portability bet. diff. systems vs. portability
|> bet. diff. Amiga compilers?) or are their performance differences?

Usually ANSI routines must be implemented "on top of" system routines,
at least for things like timer calls and I/O.  This implies that they
will make your code larger.  On time calls, the AmigaDOS call will
probably be faster, too.  However, the ANSI library functions are
buffered, which means that they will probably give better performance
than AmigaDOS Read() and Write() on most programs... it really depends
on your application.

The general rule is, use the lowest-level routine that you can
conveniently use.  Given two routines of equal functionality,
one at the system level and one at the ANSI library level,
the system level will probably be smaller and faster; however,
if your program must run on other systems, the ANSI routines
are more "convenient" for you.

|> Does clock() {ANSI} return a value based on the hardware clock less accurately
|> than the timer() {AmigaDOS} ignoring their return type differences?

Actually, clock() is an exception.  I implemented clock() myself,
and it is pretty efficient and does use AmigaDOS calls directly.
I don't think you could do much better in your own code.

|> >(Actually, assuming the fields in the DateStamp structure can
|> >never be negative, you could use a simple memcmp() on it...
|> >hmmm....)
|> 
|> Is this a hint on how you might optimize functions that do this?

No, I don't think it would be a good idea.  Somebody somewhere will
have done some operations on the DateStamp structure and the fields
WILL come out negative.  You could, of course, use that technique
on your own code if you're confident that never happens to you.

|> Just wanted to add my $.02 worth re: SAS/C v6.x.  After receiving version 6.0
|> in the mail as an upgrade, I was really impressed by the professional quality
|> of the package.  Admittedly, a lot of the major changes (ie: better Workbench
|> interface) was in 5.10b, but the new context sensitive help, EMITS tech.
|> support and performance improvements brings the premier Ami. C devel. package
|> just C++ shy from Borland C Pro. -- The top C devel. system for
|> MS-DOS/Windows.

Thanks for the compliment, and the support.

|> REPLY TO: dmak@draper.com	OR	dmak@dworkin.ccs.northeastern.edu

-- 
  *****
=*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
 *|. o.| ||                                          1200/2400/9600 Dual
  | o  |//     For all you do, this bug's for you!
  ====== 
usenet: walker@unx.sas.com                            bix: djwalker 
Any opinions expressed are mine, not those of SAS Institute, Inc.