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: kilgallen@eisner.decus.org (Larry Kilgallen) Subject: Re: CRC in Ada? Date: 1997/03/05 Message-ID: <1997Mar5.131846.1@eisner>#1/1 X-Deja-AN: 223336481 X-Nntp-Posting-Host: eisner.decus.org References: <1997Mar2.220652@nova.wright.edu> <331d3cf9.1190126@news.logica.co.uk> <1997Mar5.083233.1@eisner> X-Nntp-Posting-User: KILGALLEN X-Trace: 857585930/499 Organization: LJK Software Newsgroups: comp.lang.ada Date: 1997-03-05T00:00:00+00:00 List-Id: In article , bobduff@world.std.com (Robert A Duff) writes: > In article <1997Mar5.083233.1@eisner>, > Larry Kilgallen wrote: >>For Ada, I would guess that implementors have not counted on >>people using C-like programming constructs (vs. doing large >>buffer reads as suggested earlier in this thread). >> >>It is certainly possible to build an Ada environment optimized for >>single-character reads, but that would not seem to be a priority >>for most Ada compiler customers. > > I think I disagree. Buffering should be the job of the OS and/or > standard libraries. Not every program. While theoretical computing and Alan Turing may be centered on the equivalence and correctness of programs, in the real world performance is also a consideration. Just as those using intense computation will be concerned about the efficiency of their algorithms, those accessing large databases will take care regarding order-of-access so as not to go skipping over the whole thing when some locality-of-reference would yield better performance. Those reading sequentially from disk should likewise concern themselves with performance, and 512 calls to even the lightest-weight library is too much if a single call would do. For the stated problem (CRC) reading large blocks is a clear win. > I'm not sure why reading a file character-by-character is "C-like". > It seems like the natural way to write lots of programs, in any > language. The underlying language and OS should ensure that it can be > done efficiently (by making the "give-me-a-char" routine read from a > buffer whenever appropriate). In my experience it is generally C programmers who make this mistake. Perhaps it because many of them come from a Unix background where there is no strong sense of a "record". On the other hand, it may just be that there are so many C programmers that statistically speaking most of the mistakes made will be made by a C programmer. Larry Kilgallen