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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC 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: "Tarjei T. Jensen" Subject: Re: GNAT: Performance of String functions Date: 1997/07/22 Message-ID: <33D4F30F.5299@online.no>#1/1 X-Deja-AN: 258165367 References: <5r1l6e$e0h$1@ratatosk.uio.no> <1997Jul22.071638.1@eisner> Organization: Jensen programvareutvikling Reply-To: tarjei@online.no Newsgroups: comp.lang.ada Date: 1997-07-22T00:00:00+00:00 List-Id: >> >>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. A "smart" compiler is paramount since we cannot do anything about the assignment operator in Ada. We can write a custom procedure or function to handle assignment, but it is not the same as ":=". I would be delighted if someone could show that a smart compiler is not neccessary to optimize counted or bounded string operations. Greetings, -- // Tarjei T. Jensen // tarjei@online.no || voice +47 51 62 85 58 // Support you local rescue centre: GET LOST!