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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4f316de357ae35e9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-02 22:08:09 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: achrist@easystreet.com Newsgroups: comp.lang.ada Subject: Re: FAQ and string functions Date: Fri, 02 Aug 2002 22:07:34 -0700 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <3D4B6516.C952DF5E@easystreet.com> X-Mailer: Mozilla 4.79 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 References: <20020730093206.A8550@videoproject.kiev.ua> <4519e058.0207300548.15eeb65c@posting.google.com> <20020731104643.C1083@videoproject.kiev.ua> <4519e058.0208010629.5e6182ca@posting.google.com> <20020801194720.Q1080@videoproject.kiev.ua> <4519e058.0208020605.5ab7e092@posting.google.com> <3D4AAF63.72782659@san.rr.com> <3D4B2382.7030209@telepath.com> <3D4B2ACD.FDA29B9A@san.rr.com> <3D4B401E.3060802@telepath.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:27641 Date: 2002-08-02T22:07:34-07:00 List-Id: Ted Dennison wrote: > > no problem at all if you program everthing functionally. > Just a few weeks ago I wrote an Ada program that does lots of string splitting and concatenation, and I wrote it functionally, and it runs very slowly. Things like extracting the nth item in a string by extracting the 1st item n times and all that, all recursively. I'm guessing that some of the performance problem is related to Ada not being a functional language and that if you want to write functional programs, Ada is not the best choice. I'm not sure, just guessing. Is that true? Does a typical Ada compiler, for example GNAT 3.14 public edition that I used, have optimizations for tail-recursive functions? Or will I get into trouble if I over-abuse recursion in Ada? For example, if I was recursively splitting a string of 100 kb into 1,000 pieces, might I eat up 100 Meg of stack or even crash? As I understand it, compilers for functional languages generate code so that programs that are written functionally with proper tail recursion run pretty much as efficiently as they would if they were written loopishly. That won't happen with Ada, will it? Al