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-Thread: 103376,bed2755a22ee69a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news1.google.com!news3.google.com!news.glorb.com!news.cs.univ-paris8.fr!proxad.net!fdn.fr!news.wanadoo.fr!news.wanadoo.fr!not-for-mail Message-ID: <45DC988E.7040800@obry.net> Date: Wed, 21 Feb 2007 20:07:58 +0100 From: Pascal Obry Organization: Home - http://www.obry.net User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: comp.lang.ada To: Rob Norris Subject: Re: Text Processing in Ada 95 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Date: 21 Feb 2007 20:08:02 CET NNTP-Posting-Host: 82.124.255.131 X-Trace: 1172084882 news.orange.fr 25942 82.124.255.131:4652 X-Complaints-To: abuse@orange.fr Xref: g2news2.google.com comp.lang.ada:9376 Date: 2007-02-21T20:08:02+01:00 List-Id: Rob Norris a �crit : > Currently I'm using text_io which means I have to copy the whole thing > into memory, insert the line then over write the file with new > contents. direct_io is not an option (varing string lengths) Use Text_IO ok, but why copy all in memory. Just write to a temp file, delete the original one and rename the temp file. > What alternatives should I consider for making insertions faster? > (NB retrieval of a line needs to be fairly quick as well). If you have a lot of modifications to do on the file, then you probably need to read all the file in memory to have good performances. In this case, read file in blocks using Stream_IO. Do the changes in memory and write it back in blocks using Stream_IO. Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595