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: David L Brown Subject: Re: CRC in Ada? Date: 1997/03/04 Message-ID: #1/1 X-Deja-AN: 223109800 References: <1997Mar2.220652@nova.wright.edu> Organization: VisiCom Laboratories, Inc. Newsgroups: comp.lang.ada Date: 1997-03-04T00:00:00+00:00 List-Id: garriga@logica.com (Stephen Garriga) writes: > _IF_ you are doing the CRC on a file (as I was), I would advise you > to consider performance. I found (exactly the same algorithm) > implemented in C took an order of magnitude seconds less to execute > than the Ada equivalent. Well, I tried this. I wrote a small program to read files and compute CRC16's on them. What I found was disheartening. The CRC code didn't take very long. However, the Stream_IO read of the data was very slow. I traced it down to doing a call to the C read function for each byte. I'm using GNAT 3.09 on Linux (pentium). Is there anything about the specification for Stream_IO (or Text_IO for that matter) that is causing the GNAT runtime to turn off buffering. This is a real performance hit, and I have had to revert to calling the C routines directly when streams would be adequate, if they just weren't so inefficient. Dave