Why the hell doesn't foreach decode strings
Steven Schveighoffer
schveiguy at yahoo.com
Mon Oct 24 07:02:24 PDT 2011
On Sat, 22 Oct 2011 05:20:41 -0400, Walter Bright
<newshound2 at digitalmars.com> wrote:
> On 10/22/2011 2:21 AM, Peter Alexander wrote:
>> Which operations do you believe would be less efficient?
>
> All of the ones that don't require decoding, such as searching, would be
> less efficient if decoding was done.
Searching that does not do decoding is fundamentally incorrect. That is,
if you want to find a substring in a string, you cannot just compare chars.
But if you want to do the fundamentally incorrect thing (perhaps because
you as the programmer know the limits of what the data may contain), then
you should be able to do that for efficiency. But to default to something
incorrect and then claim it's for efficiency is almost laughable.
If I gave you an O(lg(n)) shortest path algorithm that did not always find
the shortest path, would you agree it was an improvment over dijkstra's?
-Steve
More information about the Digitalmars-d
mailing list