Re: Hey Karl...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Larry,

"Larry Serflaten" <serflaten@xxxxxxxxxxxxxx> wrote in message news:uwUgzZ3tJHA.3988@xxxxxxxxxxxxxxxxxxxxxxx

"Bill McCarthy" wrote
> Having the shorter tests in front should provide for
> quicker iteration through the first items in the list, while having > most
> likely input up front would reduce the number of tests performed.

I doubt that very much. The first test of a string comparison is most
likely to see if the string lengths are the same. If the lengths are the
same then the comparison begins which itself will exit as soon as a buffer
becomes unequal (buffers are sometime optimized to be read as 32 bit on 32
bit systems etc)

That could be,

Well it would be simple enough to test. I would be amazed if the comparison code didn't compare lengths first.


but you did not address the other optimization which was
to put most likely input in front.


Right. That's a different optimisation from the one saying put shorter strings first.

That is just common sense. Its a
trade off, or as I mentioned earlier, its subjective, but it is something
that should be considered when the list grows long.


If you were really serious about optimising that code the first thing it should do is test for the most common strings *without* doing any case changing, eg: check for "true" and "True". But you'd really need to be crunching the parsing for any such optimisation to ever be of any real significance.





















.



Relevant Pages

  • Re: Implement memcmp function with help from gccs inline asm
    ... >> comparison the way memcmp intends. ... only to the highest level of optimisation. ... I would have expected that for small lengths the library function would ... The glibc implementation of memcmp on x86 platforms could slightly better ...
    (comp.lang.asm.x86)
  • Re: handling large character arrays
    ... allocatable array of single characters. ... Why the redundancy of the separate component for the string length? ... I might be tempted to use a long character string as a storage ... That does assume that the data item lengths don't change after ...
    (comp.lang.fortran)
  • Re: C Slower than Python?
    ... seconds without the loop overhead. ... and by pretending that string lengths are available. ... Try adding two extra variables to store ...
    (comp.lang.c)
  • Re: Efficency and the standard library
    ... Compare this to the implementation in the Better String ... No it is based on exponential realloclengths for the backing ... have been nice to have a separate tool for linked lists. ... pointer to void. ...
    (comp.lang.c)
  • Re: Rope ladder Yagi on upper HF
    ... I wonder if these are typos, or if they are the actual measured lengths of the finished aerial. ... When there is no further improvement the optimisation is stopped. ... Hence you can end up with an optimised yagi with higgledy pigledy lengths and spacing,because there are many solutions for the optimum. ... Brian GM4DIJ ...
    (uk.radio.amateur)