From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: String Buffer
Date: Thu, 2 Dec 2021 21:15:11 +0100 [thread overview]
Message-ID: <sob9gf$5mh$1@gioia.aioe.org> (raw)
In-Reply-To: sob8df$vbj$1@dont-email.me
On 2021-12-02 20:56, Jeffrey R.Carter wrote:
> On 2021-12-02 19:17, Kevin Chadwick wrote:
>>
>> Unbounded is said to be inefficient because it re-allocates.
>>
>> In any case avoiding unbounded strings is almost certainly in the
>> realm of premature optimisation
I see it as a design question. Code that modifies a string as a whole is
most likely broken. Unbounded_String property of varying length is not
needed except for very special cases, like passing parameters where no
result is allowed, e.g. in the task entries. Most, if not all such cases
are Ada language design deficiencies. Normally there should be no need
for Unbounded_String.
> In the absence of such context, any claims of "inefficiency" (and
> especially blanket claims such as "Unbounded_String is inefficient")
> simply demonstrate the speaker's incompetence.
It is true only to a certain degree. When comparing algorithms it is
valid to claim inefficiency without any context if computational
complexity sufficiently differs.
For example, an O(N) algorithm is unquestionably inefficient comparing
to O(log N) one. I leave marginal cases of very small N.
Unbounded_String uses storage pool and that is a qualitative difference
that requires in any context. For very large text buffers they are
unusable either. Again, it is a design question, any time I see
Unbounded_String alarm bells start ringing.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2021-12-02 20:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-02 18:17 String Buffer Kevin Chadwick
2021-12-02 19:56 ` Jeffrey R.Carter
2021-12-02 20:15 ` Dmitry A. Kazakov [this message]
2021-12-02 21:06 ` Jeffrey R.Carter
2021-12-02 21:45 ` Dmitry A. Kazakov
2021-12-03 0:49 ` Kevin Chadwick
2021-12-03 5:25 ` Randy Brukardt
2021-12-03 8:31 ` ldries46
2021-12-02 20:51 ` Simon Wright
2021-12-03 8:11 ` Vadim Godunko
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox