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,e6c9800e35ccfeee X-Google-Attributes: gid103376,public From: kilgallen@eisner.decus.org (Larry Kilgallen) Subject: Re: GNAT: Performance of String functions Date: 1997/07/23 Message-ID: <1997Jul23.065317.1@eisner>#1/1 X-Deja-AN: 258299822 X-Nntp-Posting-Host: eisner.decus.org References: <5r1l6e$e0h$1@ratatosk.uio.no> <1997Jul22.071638.1@eisner> <33D4F30F.5299@online.no> X-Nntp-Posting-User: KILGALLEN X-Trace: 869655202/1498 Organization: LJK Software Newsgroups: comp.lang.ada Date: 1997-07-23T00:00:00+00:00 List-Id: Sorry for the extensive quote, but enough context may shorten this discussion. In article <33D4F30F.5299@online.no>, "Tarjei T. Jensen" writes: >>> >>>Tarjei T. Jensen writes: >>> >>> I suspect bounded strings will perform badly against a counted string >>> implementation because assignment of strings involves copying the entire array >>> whether it contains valid data or not. This makes Ada less than wonderful in >>> applications that involve a lot of bounded string assignments. >> >>Larry Kilgallen wrote: >> No, it might affect particular _implementations_ of Ada, but I have >> read no indications that counted strings would not be a valid way of >> implementing bounded strings. If the Varying String datatype made >> quite public by DEC Pascal were used in some Ada implementation to >> implement bounded strings (and for all I know, it or something quite >> close to it is) execution should be quite efficient for strings >> below a certain size (ultimately one gets into page faults, cache >> misses and other stack-vs-heap issues). >> >> Larry Kilgallen > > That would mean that the implementation supply a default maximum size. > If the implementation should be more effective than the usual bounded > string implementation the compiler whould have to know what the real > length of a string is for assignments. Otherwise the code generated > spends a lot of time copying junk data. I guess I don't know enough about the bounded string type. I presumed the programmer could specify the maximum size (bound?). In DEC Pascal one does that per variable, and for an Assignment the generated code copies only as many bytes as are actually used in the source string. The runtime image in memory certainly carries an indication of the current length. Larry Kilgallen