From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9c86eb13dd395066 X-Google-Attributes: gid103376,public From: Jim Balter Subject: Re: CRC in Ada? Date: 1997/03/10 Message-ID: <3324A8B9.4A18@netcom.com>#1/1 X-Deja-AN: 224529565 References: <1997Mar2.220652@nova.wright.edu> <1997Mar5.083233.1@eisner> <1997Mar5.131846.1@eisner> Organization: JQB Enterprises X-NETCOM-Date: Mon Mar 10 6:37:10 PM CST 1997 Newsgroups: comp.lang.ada Date: 1997-03-10T18:37:10-06:00 List-Id: Robert Dewar wrote: > > TD/DELAB (?) said > > < implementation where it would be a disaster. The C single char IO > operations are not complicated, and have very little overhead. What > makes you think otherwise? > >> > > I'll tell you what. Go measure the relative speed of reading a 1 meg > file a character at a time, vs using read to read the entire 1 meg at > a time. Do this measurement on at least six different systems. Come > back here with the results and we will discuss them! Instead of being stupid about it, how about just looking at the getchar macro, which is virtually the same on every single system? I've done this repeatedly over the last nearly 20 years on many many systems. There is a small overhead per byte due to the getchar macro, which is reduced with good optimizing compilers and good caching hardware. For the inner loop of "cat", the getchar cost predominates. For anything else, it doesn't. This is basic algorithmic analysis, which you can find good references for in your local library, if you ever bother to head in that direction. --