comp.lang.ada
 help / color / mirror / Atom feed
From: Natasha Kerensikova <lithiumcat@gmail.com>
Subject: Re: Ann: Natools.Chunked_Strings, beta 1
Date: Thu, 1 Dec 2011 10:57:23 +0000 (UTC)
Date: 2011-12-01T10:57:23+00:00	[thread overview]
Message-ID: <slrnjdenc4.1lme.lithiumcat@sigil.instinctive.eu> (raw)
In-Reply-To: jb6101$7nt$1@tornado.tornevall.net

Hello,

On 2011-11-30, Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org> wrote:
> On 11/30/2011 06:08 AM, Natasha Kerensikova wrote:
>>
>> [An implementation optimized for appending should have better performance for
>> that use and GNAT's Unbounded_String uses a contiguous array] Combined with
>> the fact I use GNAT is enough (for me) to justify writing
>> Natools.Chunked_Strings.
>
> Justifications for rewriting Unbounded_Strings are
>
> 1. For fun
> 2. As a learning experience
> 3. You have timing requirements you can't otherwise meet.

1. and 2. were pre-conditions here. Among all the mini-projects that
meet 1. and 2., I used 3. or suspicion of 3. to choose. That's how it is
relevant.

> 3. does not appear to be the case here; you're planning to write
> something, but you have yet to demonstrate that Unbounded_Strings
> isn't suitable for its timing requirements.

I have serious reasons to believe that 3. will probably happen. While
the Ada project with requirements is not yet complete (though already
written, for the most part), it is very similar to a C project I already
wrote. And for that C project, the repeated dynamic array resizes
triggered by repeated string append are demonstrated to be the
performance bottleneck, and therefore the next thing to work on should
performance be improved.

I agree that it might turn out that the Ada project has other
performance issues. But saying that 3. will *never* be a problem is
saying that either there is a point where performance is "good enough"
and that this point is reached sooner than Unbounded_String performance
issue, or that there is some fundamental unavoidable performance hit in
Ada that does not exist in C.

It stills seems to me fair to assume the latter is wrong, and the former
is a suspiciously strong assumption on my project compared to what I
disclosed about it.

> So you're doing it for 1.
> or 2. Doing it for 3. when you haven't demonstrated 3. is premature
> optimization, AKA the root of all evil.

I don't need a hard demonstration with numbers and benchmarks to know
the weak points of my designs. Especially when I do have them for a very
similar design. And unless there is a "good enough" line or an expected
performance flaw in Ada, I'm certain that Unbounded_String append
performance *will* be an issue.

Moreover, I strongly doubt any evil can come from these performance
considerations. A mere package cannot do any evil. The premature
optimization that is actually at the root of any evil is when
unwarranted performance consideration creep up to the design phase. As I
said above, my considerations are far from being unwarranted, and the
only design choice that could be qualified as premature optimization is
the use of String_Accumulator interface (rather than naive direct calls
to Ada.String.Unbounded subprograms). I would be happy to hear arguments
for or against that choice.

> FWIW, we have a large, soft-real-time system that makes extensive use of 
> Unbounded_Strings, and have no problem meeting our timing requirements.

Then I guess you are lucky enough to have a "good enough" line (and to
be on the good side of it).


Natasha



  reply	other threads:[~2011-12-01 10:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29 15:16 Ann: Natools.Chunked_Strings, beta 1 Natasha Kerensikova
2011-11-29 15:37 ` Pascal Obry
2011-11-29 16:34   ` Natasha Kerensikova
2011-11-29 17:08     ` Georg Bauhaus
2011-11-30  9:51       ` Natasha Kerensikova
2011-11-29 20:25     ` Randy Brukardt
2011-11-30 10:44     ` Yannick Duchêne (Hibou57)
2011-11-30 10:39   ` Yannick Duchêne (Hibou57)
2011-11-30 10:57     ` Dmitry A. Kazakov
2011-12-01  0:11       ` Randy Brukardt
2011-12-01  8:30         ` Dmitry A. Kazakov
2011-12-01 23:26           ` Vinzent Hoefler
2011-12-02  8:27             ` Dmitry A. Kazakov
2011-12-02  9:30               ` Georg Bauhaus
2011-12-02 13:11                 ` Dmitry A. Kazakov
2011-12-02  0:39           ` Randy Brukardt
2011-12-01  9:02         ` Yannick Duchêne (Hibou57)
2011-11-30 13:08     ` Natasha Kerensikova
2011-11-30 19:39       ` Jeffrey Carter
2011-12-01 10:57         ` Natasha Kerensikova [this message]
2011-12-01 19:07           ` Jeffrey Carter
2011-12-01 21:19             ` Yannick Duchêne (Hibou57)
2011-12-01 22:49               ` Natasha Kerensikova
2011-12-02 16:16         ` Tero Koskinen
2011-12-02 17:36           ` Adam Beneschan
2011-12-02 18:52             ` Tero Koskinen
2011-12-02 18:14           ` Yannick Duchêne (Hibou57)
2011-12-02 19:07             ` Adam Beneschan
2011-11-30 10:33 ` Yannick Duchêne (Hibou57)
2011-11-30 11:04   ` Natasha Kerensikova
replies disabled

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