comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <dont.bother.mcondic.auntie.spam@[acm.org>
Subject: Re: functions, packages & characters
Date: Mon, 25 Feb 2002 15:49:02 -0500
Date: 2002-02-25T20:49:04+00:00	[thread overview]
Message-ID: <a5e800$2ic$1@nh.pace.co.uk> (raw)
In-Reply-To: u7l4ih2guo0gf6@corp.supernews.com

"Randy Brukardt" <randy@rrsoftware.com> wrote in message
news:u7l4ih2guo0gf6@corp.supernews.com...
>
> I thought I said that if you make the buffer large enough, it wouldn't
> be so slow -- but it also would require a large buffer for many
> applications (if it didn't, there would be little reason to use
> unbounded strings in the first place).
>
O.K. I must have misunderstood. Clearly if you pick a buffer size that
accommodates *most* of the lines you're likely to read, you'd have no real
problem dealing with some small percentage of the cases where you'd have
something reallocating more and more memory.


>
>
> I can only comment on the Janus/Ada one (which may not be
> representative). It just allocates a string of the correct length for
> every operation. That is the easiest implementation (and the one that
> GNAT 3.14 uses), but it uses the heap a lot. Improving the performance
> of this library has not been a priority, as there isn't any point in
> trying to "optimize" it unless you have some real applications using it
> that are too slow. Otherwise, you run the risk of making the "average"
> application slower.
>
Interesting. So in the cases where you'd be doing insertions, deletions and
so forth, you'd be forcing a reallocation for every operation? Obviously,
that could get expensive if you're doing a lot of string manipulation. I
could imagine it being a bit more efficient if it allocated memory in blocks
to enable some expansion & contraction without having to go back for more
every time.


> In any case, Ada.Strings.Unbounded is inappropriate for long-running
> applications (such as the AdaIC web server), because continued use of
> the heap will eventually lead to fragmentation and memory exhaustion
> (and decreasing performance in a virtual memory environment).
>
If the strings you're dealing with require a lot of manipulation this would
be the case. I've had apps that deal with a relatively static body of text -
you may not know its initial size, but once loaded it might remain stable.
Its always important to look at how it gets used and understand what the
penalties are for using a given feature.

I've used Unbounded_String a lot and never found it to behave poorly in the
kinds of apps I've done that way. Of course, most of these didn't really
stress test it - they've been pretty straightforward text manipulation
things where the ease of use for Unbounded_String outweighed whatever
inefficiencies may have been there.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/





  reply	other threads:[~2002-02-25 20:49 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-21  8:59 functions, packages & characters Christoph Grein
2002-02-21 18:07 ` Unversed Angel
2002-02-21 18:28   ` Hyman Rosen
2002-02-21 23:44     ` Randy Brukardt
2002-02-22  0:37       ` Matthew Heaney
2002-02-22  1:12         ` Matthew Heaney
2002-02-22  2:57         ` Randy Brukardt
2002-02-22 13:54           ` Marin David Condic
2002-02-23  1:10             ` Matthew Heaney
2002-02-25 15:47               ` Marin David Condic
2002-02-26 15:58                 ` Matthew Heaney
2002-02-25 19:37             ` Randy Brukardt
2002-02-25 20:49               ` Marin David Condic [this message]
2002-02-26  3:30               ` David Starner
2002-02-26 15:44                 ` Hyman Rosen
2002-02-26 21:43                   ` David Starner
2002-02-27  6:32                     ` Hyman Rosen
2002-02-28  3:55                       ` Chad R. Meiners
2002-02-28 18:44                         ` Hyman Rosen
2002-03-02  3:25                           ` Chad R. Meiners
2002-03-03  8:22                             ` Hyman Rosen
2002-03-03 17:50                               ` Chad R. Meiners
2002-03-01  2:08                         ` David Starner
2002-03-05 14:36                       ` Marin David Condic
2002-02-26  7:42               ` tmoran
2002-02-22 15:34           ` Matthew Heaney
2002-02-22  2:47       ` Jeffrey Carter
2002-02-22 13:41       ` Marin David Condic
2002-02-23  1:08         ` Matthew Heaney
2002-02-23  2:03         ` Jeffrey Carter
2002-02-22 16:27       ` Hyman Rosen
2002-02-21 23:49     ` unversedangel
2002-02-21 22:48   ` unversedangel
2002-02-21 23:14     ` Hyman Rosen
2002-02-22 14:11     ` Marin David Condic
  -- strict thread matches above, loose matches on Subject: below --
2002-02-21  0:16 Unversed Angel
2002-02-21  0:37 ` tmoran
2002-02-21  1:13   ` Unversed Angel
2002-02-21  2:53     ` tmoran
2002-02-21  8:25       ` Unversed Angel
2002-02-21 13:47         ` Marin David Condic
2002-02-22  0:22         ` tmoran
replies disabled

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