Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Cor Ligthert (notmyfirstname_at_planet.nl)
Date: 09/28/04


Date: Tue, 28 Sep 2004 21:44:14 +0200

Jay,

I was first going for the arraylist and the the stringbuilder as forever as
you know, however

Pieter told a to z and A to Z and space, that can be done as bytes
97 to 122 and 65 to 90 and 32.

Pieter lives in Belgium which has the same code set as you and me and he
told this explicitly because in Belgium is spoken Dutch and French (a very
small minority German) and the French uses a lot of characters which are not
ASCII however as far as I know in the standard 255 set (maybe can Pieter
tell that).

He told only the characters in the ASCII range so you can be sure that he as
a Belg did that explicitly.

It will be a very huge table so I in my opinion. I once did a test between a
stringbuilder against a bytearray (however silly one because it needed
chars, but somebody told his routine was faster so I made that to tell that
everything can go faster) where the bytearray was twice as fast.

There is in this case for sure only one byte needed instead of two. The only
place you loose some bytes against the characterstring is as far as I can
see when there are spaces at the end, however that will be a minority and
everytime less.

When it would be used, than it should be converted to a string, however
that can even with ASCII in this case. (And this is probably an exception
where this just fit)

I think it will not be that big difference with you method at the moment, it
uses at least than less memory I think and probably go faster.

However just what I thought, never tested, so when I have made mistakes in
this, tell it.

:-)

Cor

"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@msn.com>

> Cor,
> How would saving 17 bytes really be saving anything?
>
> How would an array of Byte be any faster then an array of Char? Especially
> when I would expect the function that the OP is calling needs a String? I
> agree if the OP's function needed an array of Byte, then an array of Byte
> is needed, however the OP suggested Chars (A to Z, a to z and space).
>
> My routine works directly with Unicode Chars there is no encoding involved
> (an array of Byte would need an "expensive" Encoding object to convert
> from Bytes to Chars or String.
>
> Just curious where you are coming from.
>
> Jay
>
> "Cor Ligthert" <notmyfirstname@planet.nl> wrote in message
> news:Om0lZtWpEHA.1164@TK2MSFTNGP10.phx.gbl...
>> Jay B.
>>
>> I think that an array of bytes would in this case be the fastest and also
>> would help to minimize the used space.
>>
>> Cor
>>
>
>



Relevant Pages

  • Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)
    ... Pieter lives in Belgium which has the same code set as you and me and he ... > How would an array of Byte be any faster then an array of Char? ... > when I would expect the function that the OP is calling needs a String? ... > is needed, however the OP suggested Chars. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)
    ... > It will be a very huge table so I in my opinion. ... > When it would be used, than it should be converted to a string, however ... >> How would an array of Byte be any faster then an array of Char? ... >> array of Byte is needed, however the OP suggested Chars (A to Z, a to z ...
    (microsoft.public.dotnet.languages.vb)
  • Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)
    ... > It will be a very huge table so I in my opinion. ... > When it would be used, than it should be converted to a string, however ... >> How would an array of Byte be any faster then an array of Char? ... >> array of Byte is needed, however the OP suggested Chars (A to Z, a to z ...
    (microsoft.public.dotnet.general)
  • Re: communication via gpib-drivers in c#
    ... > is there a way converting this decimal type with the ascii-code in it into ... > string or an array of chars? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: comp algorithms
    ... I am saying a array, eg, that takes 4 times as much space as the input ... sorting by the associated string values gives the order: ... done in the first few chars, would be to do sorting initially as: ...
    (comp.compression)