comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: When to use Bounded_String?
Date: Thu, 28 Dec 2017 18:36:19 -0600
Date: 2017-12-28T18:36:19-06:00	[thread overview]
Message-ID: <p242m3$gmh$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 37c30172-9386-45fb-86d0-a10998fcade8@googlegroups.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

<vincent.diemunsch@gmail.com> wrote in message 
news:37c30172-9386-45fb-86d0-a10998fcade8@googlegroups.com...
Le jeudi 28 décembre 2017 13:00:46 UTC+1, Dmitry A. Kazakov a écrit :
...
>> P.S. Just never copy strings if you have performance concerns (even if
>> you have none). Nothing to optimize then. Use string slices, pass string
>> + an index to start at, do everything in a single pass, there is no
>> reason to waste CPU time, memory and brain cells on "tokenizing".
>
>True. Except for storing the identifiers in a symbol table...

It's probably good advice in general, but as always it depends on the 
problem in question. If the problem can be solved better by a sequence of 
transformations rather than something monolithic, then copying is 
inevitable. For instance, in my spam filter, I have a transformed version of 
the message that contains just the text (eliminating the markup, line ends, 
and the like), to be used for phrase matching. Otherwise, the spammer could 
easily hide bad phrases by including (invisible) markup or line endings. 
That requires a copy of the string.

                           Randy.



  reply	other threads:[~2017-12-29  0:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-19  2:19 When to use Bounded_String? Victor Porton
2017-11-19  9:55 ` Niklas Holsti
2017-11-20  5:38   ` J-P. Rosen
2017-11-20  7:32     ` Niklas Holsti
2017-11-23 10:04 ` briot.emmanuel
2017-12-28 11:46   ` Vincent DIEMUNSCH
2017-12-28 12:00     ` Dmitry A. Kazakov
2017-12-28 12:29       ` Mehdi Saada
2017-12-29  0:42         ` Randy Brukardt
2017-12-29  9:11         ` Simon Wright
2017-12-28 14:28       ` vincent.diemunsch
2017-12-29  0:36         ` Randy Brukardt [this message]
2017-12-29  8:48           ` Dmitry A. Kazakov
replies disabled

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