comp.lang.ada
 help / color / mirror / Atom feed
From: stephen_bevan@yahoo.com (Stephen J. Bevan)
Subject: Re: is ada dead?
Date: Sun, 08 Jul 2001 05:29:25 GMT
Date: 2001-07-08T05:29:25+00:00	[thread overview]
Message-ID: <m31yns3s9v.fsf@yahoo.com> (raw)
In-Reply-To: 3B47D830.830E4E31@worldnet.att.net

James Rogers <jimmaureenrogers@worldnet.att.net> writes:
> Yes. The Stringbuffer class is much more efficient than the String
> class for editing purposes. It is still terribly inefficient 
> compared to, for instance, Ada strings.

Do you mean String or an Unbounded_String?  IMHO a Java StringBuffer
has very similar properties to an Ada Unbounded_String.  If you want
an equivalent of an Ada String, then the best approximation would be
char[] in Java.


> Remember the extra processing overhead needed to use a StringBuffer
> also. Consider the StringBuffer a linked list of characters.
> I say this because the StringBuffer is resizable, while the String
> class, and Java arrays are not. This means that the StringBuffer
> cannot be implemented using an array.

Actually it is implemented as an char[] -- at least in Sun's
implementation anyway.  If you turn a String into a StringBuffer then
it allocates an array large enough for the string plus some slop space
(16 characters).  If you append enough characters to fill the slop
space then a new array is created with a size 2* the current one and
all the characters are copied over.  This has bad worst-case
properties, especially for appending, but it seems to suffice on
average (I've certainly used it on quite a few occasions and it didn't
show up in profiling).  If you need something with better worst-case
properties then you can build it based on a char[].


> by garbage collection. Some Java garbage collectors do not
> defragment memory after collection. Heavy use of a StringBuffer
> can result in highly fragmented memory. This may not be a memory
> leak, but it can result in the eventual inability to allocate
> a needed block of memory.

Agreed, its a quality of implementation issue.  But then so is the
quality of the memory allocation routines you get with an Ada
implementation.  In both cases if you are not happy you can either
write your own pooling code or try a different implementation.


> The StringBuffer is still highly inefficient compared to the 
> ability to edit characters in place in a string.

I agree.  However, if you know you want to edit a String then the best
thing is to avoid making it a String in the first place and either
keep it as a char[] or wrapped in a StringBuffer.



  reply	other threads:[~2001-07-08  5:29 UTC|newest]

Thread overview: 169+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-05 21:56 is ada dead? tyler spivey
2001-07-05 23:11 ` James Rogers
2001-07-06  0:21 ` Gerhard Häring
2001-07-06  2:31 ` wzm
2001-07-06  7:47 ` Pascal Obry
2001-07-06 12:12 ` Martin Dowie
2001-07-06 21:33   ` Bobby D. Bryant
2001-07-06 14:04 ` Marin David Condic
     [not found]   ` <3B45E0E9.E3E7BB55@nokia.com>
2001-07-06 16:45     ` Marin David Condic
2001-07-06 18:28 ` Robert Dewar
2001-07-06 19:12 ` Lao Xiao Hai
2001-07-07  1:57   ` Adrian Hoe
2001-07-06 21:36     ` Bobby D. Bryant
2001-07-07 10:53       ` Larry Kilgallen
2001-07-07 18:44         ` James Rogers
2001-07-07 21:19           ` String support (was: is Ada dead?) Larry Kilgallen
2001-07-08  3:15           ` is ada dead? Stephen J. Bevan
2001-07-08  3:46             ` James Rogers
2001-07-08  5:29               ` Stephen J. Bevan [this message]
2001-07-09 14:27                 ` Marin David Condic
2001-07-08 11:07             ` Larry Kilgallen
2001-07-08 14:57               ` Stephen J. Bevan
2001-07-08 13:34       ` Me
2001-07-07 18:33     ` James Rogers
2001-07-07 22:41       ` Andrzej Lewandowski
2001-07-08  0:58         ` Larry Kilgallen
2001-07-09  1:33           ` Florian Weimer
2001-07-08  1:45         ` Jeffrey Carter
2001-07-08 17:19           ` Robert C. Leif, Ph.D.
2001-07-08 21:28             ` Larry Kilgallen
2001-07-09  2:46               ` Robert C. Leif, Ph.D.
2001-07-09 10:36                 ` Mandating code quality (was: is Ada dead?) Larry Kilgallen
2001-07-08 10:52         ` is ada dead? Michal Nowak
2001-07-08 22:38           ` Andrzej Lewandowski
2001-07-09  1:20             ` James Rogers
2001-07-09 14:45               ` Marin David Condic
2001-07-09 15:54                 ` Ted Dennison
2001-07-09 20:27                   ` Jerry Petrey
2001-07-09 21:08                     ` Ted Dennison
2001-07-14 16:49                     ` Stefan Skoglund
2001-07-10 23:59                   ` Why " raj
2001-07-14 16:53                     ` Stefan Skoglund
2001-07-14 23:14                       ` James Rogers
2001-07-15 22:57                         ` Stefan Skoglund
2001-07-16 14:00                         ` Trains in the US (was: Why is ada dead?) Ted Dennison
2001-07-10 23:56                 ` Why is ada dead? raj
2001-07-11  2:59                   ` James Rogers
2001-07-09 16:50             ` Michal Nowak
2001-07-15 18:14             ` Lao Xiao Hai
2001-07-16 15:38               ` Marin David Condic
2001-07-16 17:32                 ` Mark Lundquist
2001-07-16 22:18                   ` tmoran
2001-08-01 18:53                     ` "first-mover (dis)advantage" (was Re: is ada dead?) Mark Lundquist
2001-08-02 15:44                       ` Ted Dennison
2001-07-21 16:30                   ` is ada dead? Bertrand Augereau
2001-07-16 18:19                 ` Larry Kilgallen
2001-07-16 18:21                   ` Marin David Condic
2001-07-16 20:14                     ` Gary Scott
2001-07-16 18:26                   ` Mark Lundquist
2001-07-16 21:21               ` Michal Nowak
2001-07-10 23:31         ` raj
2001-07-10 23:32         ` raj
2001-07-10 23:46         ` "garbage dumps are full of superior solutions" raj
2001-07-10 23:47         ` Managers believe that Ada programmers are hard to find raj
2001-07-11  9:38           ` Martin Dowie
2001-07-11 12:39           ` Marc A. Criley
2001-07-11 17:32           ` Jeffrey Carter
2001-07-11 19:05             ` Pat Rogers
2001-07-07 22:37     ` is ada dead? Andrzej Lewandowski
2001-07-08  1:10       ` James Rogers
2001-07-08  1:47       ` Jeffrey Carter
2001-07-08  9:01       ` Pascal Obry
2001-07-08 10:52       ` Michal Nowak
2001-07-08 22:40         ` Andrzej Lewandowski
2001-07-09  1:48           ` James Rogers
2001-07-09 15:11           ` Jerry Petrey
2001-07-09 16:14             ` Al Christians
2001-07-09 19:35               ` Death by analogy Part 1 (was Re: is ada dead?) Michael P. Card
2001-07-09 19:52               ` Death by analogy Part 2 " Michael P. Card
2001-07-09 22:07                 ` Al Christians
2001-07-10  3:38                   ` Michael P. Card
2001-07-10  4:54                     ` Al Christians
2001-07-10 10:54                       ` Robert C. Leif, Ph.D.
2001-07-10 16:58                         ` Al Christians
2001-07-10 17:58                           ` William Dale
2001-07-10 18:39                           ` Michael P. Card
2001-07-10 20:10                             ` Ed Falis
2001-07-10 20:46                               ` Ted Dennison
2001-07-10 20:54                                 ` Ed Falis
2001-07-10 21:15                                   ` Ted Dennison
2001-07-10 21:29                                     ` Ed Falis
2001-07-10 21:10                               ` Al Christians
2001-07-10 21:26                                 ` Marin David Condic
2001-07-10 21:26                                 ` Ed Falis
2001-07-10 21:48                                   ` Ted Dennison
2001-07-10 21:56                                   ` Marin David Condic
2001-07-11  1:59                                     ` Ed Falis
2001-07-11  2:38                               ` DuckE
2001-07-11 21:00                                 ` Ed Falis
2001-07-12  1:42                                   ` DuckE
2001-07-12 10:54                                   ` UML for Ada raj
2001-07-12  8:03                                 ` Death by analogy Part 2 (was Re: is ada dead?) David Humphris
2001-07-13  2:43                                   ` DuckE
2001-07-23 21:53                                     ` Greg Bek
2001-07-20  7:49                                   ` Lao Xiao Hai
2001-07-10 20:26                             ` Ted Dennison
2001-07-10 20:39                             ` Al Christians
2001-07-10 20:42                               ` Ed Falis
2001-07-10 20:53                                 ` Marin David Condic
2001-07-10 21:11                               ` Michael P. Card
2001-07-11  5:25                                 ` Ada and UML raj
2001-07-11  9:40                                   ` David C. Hoos, Sr.
2001-07-13 19:00                                   ` Nick Williams
2001-07-13 19:46                                     ` Ted Dennison
2001-07-17  8:25                                       ` David Humphris
2001-07-16  0:56                                     ` Ken Garlington
2001-07-16  1:57                                       ` Ada and UML - Rational dropping Ada? Jeff Creem
2001-07-16 17:37                                         ` Ken Garlington
2001-07-17 18:59                                       ` Ada and UML Simon Wright
2001-07-23 14:38                                         ` John Kern
2001-08-04  6:29                                           ` Simon Wright
2001-07-11  0:25                             ` Sure FIRM is lost, but really, who cares raj
2001-07-11  0:33                             ` Death by analogy Part 2 (was Re: is ada dead?) Robert C. Leif, Ph.D.
2001-07-10 12:58                     ` John Kern
2001-07-10 13:59                   ` Marin David Condic
2001-07-10  1:21               ` is ada dead? Pat Rogers
2001-07-10  2:29                 ` Al Christians
2001-07-09  1:44       ` Florian Weimer
2001-07-08 21:05         ` Bobby D. Bryant
2001-07-09 10:43           ` One True Language (was: is Ada dead?) Larry Kilgallen
2001-07-09 15:09           ` is ada dead? Ted Dennison
2001-07-14 18:40           ` Stefan Skoglund
2001-07-09  2:37       ` Adrian Hoe
2001-07-07 23:03 ` chris.danx
2001-07-09 15:22   ` Ted Dennison
2001-07-09 16:13     ` chris.danx
2001-07-10  9:02     ` Emmanuel Briot
2001-07-10 10:29       ` Contributing patches to GPL Ada projects (was: Is Ada dead?) Larry Kilgallen
2001-07-10 12:44         ` Emmanuel Briot
2001-07-10 15:24           ` Ted Dennison
2001-07-10 22:33             ` Robert Dewar
2001-07-11  7:46               ` Florian Weimer
2001-07-11 13:07               ` Marc A. Criley
2001-07-11 16:26                 ` Robert Dewar
2001-07-11 13:41               ` Ted Dennison
2001-07-11 16:30                 ` Robert Dewar
2001-07-11 17:45                   ` Ted Dennison
2001-07-14 14:05                     ` Robert Dewar
2001-07-16 15:38                       ` Ted Dennison
2001-07-16 17:37                         ` Ken Garlington
2001-07-11 12:35           ` McDoobie
2001-07-12  8:16             ` Emmanuel Briot
2001-07-14 19:48               ` Stefan Skoglund
2001-07-15  0:16                 ` McDoobie
2001-07-18 16:17                 ` Stephen Leake
2001-07-18 17:55                   ` Pascal Obry
2001-07-19 23:13                   ` Stefan Skoglund
2001-07-20 17:05                     ` Stephen Leake
2001-07-10 13:58       ` is ada dead? Ted Dennison
2001-07-10 17:04       ` Pascal Obry
  -- strict thread matches above, loose matches on Subject: below --
2001-07-06  6:19 Vinzent Hoefler
2001-07-08 12:07 Gautier Write-only-address
2001-07-09  7:39 Vinzent Hoefler
2001-07-09 12:06 ` Jean-Pierre Rosen
2001-07-09  7:40 Vinzent Hoefler
2001-07-09 13:23 Vinzent Hoefler
2001-07-09 13:24 Vinzent Hoefler
2001-07-09 16:20 Vinzent Hoefler
2001-07-10 14:02 Vinzent Hoefler
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox