Re: Moved from C++ to Delphi

From: Martin Harvey (Demon Account) (martin_at__nospam_pergolesi.demon.co.uk)
Date: 01/06/04


Date: Tue, 06 Jan 2004 19:40:17 +0000

On Mon, 05 Jan 2004 09:35:11 +0100, Robert Marquardt
<robert_marquardt@gmx.de> wrote:

>Martin Harvey (Demon Account) wrote:
>
>> On Fri, 26 Dec 2003 09:02:28 -0000, "Joanna Carter \(TeamB\)"
>> <joannac@btinternetXX.com> wrote:
>>
>>
>>>Edit1.Text = ''
>>
>>
>> Some developers prefer Length(Edit1.Text) = 0
>>
>> :-)
>
>which is inefficient.

No it's not! LStrLen does not have to scan the string, it just reads
the length bit.

you've got one procedure call and return, a conditional jump and an
extra dereference in addition to the code in your solution. I don't
call that expensive. It's still unity cost, and if you seriously
reckon that 7 or 8 clock cycles extra is a serious inefficiency when
doing string manipulations, then you need to find something more
useful to do with your life ...

MH.



Relevant Pages

  • Re: restriction on sum: intentional bug?
    ... inefficient in this case? ... If sum already has two code branches to handle strings, let the string branch do a join. ...
    (comp.lang.python)
  • Re: Monitor unblock priority
    ... > Trying to synchronize threads in a fixed/predetermined order is highly ... could show you a string being built up inefficiently, ... problem to the one originally posed, namely releasing threads in the ... inefficient, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Is this a dumb way to count chars in a string?
    ... the use of LSet explicitly prevents String creation ... I don't know if it is inefficient but the split function is working great ... Maybe I'll try a version using your counting method and try some time ...
    (microsoft.public.vb.general.discussion)
  • Re: read - comma
    ... > But I still feel it is too inefficient, especially the concatenation ... > part and then reversing the string. ...
    (comp.lang.lisp)