Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-12

Which comparisons are faster?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Krzysztof

Hi,

I know that in normal cases those things has no matters, but I do much things in OnPaint so each millisecond is matter. For example, strings comparisons:

What is faster if string is "big":

if s'' then....

or:

if Length(s)>0 then...

Same thing with incrementations:

i := i + 1

or:

Inc(i)

or:

i += 1;

Regards

Reply by email

Mattias Gaertner
to Krzysztof
Show quoted text 13 lines
Hi, I know that in normal cases those things has no matters, but I do much things in OnPaint so each millisecond is matter. For example, strings comparisons: What is faster if string is "big": if s'' then.... or: if Length(s)>0 then...

The first.

Show quoted text 11 lines
Same thing with incrementations: i := i + 1 or: Inc(i) or: i += 1;

All the same.

Mattias

Reply by email

Krzysztof
to Mattias Gaertner

Thank you very much :)

2012/12/13 Mattias Gaertner

Show quoted text 40 lines
On Thu, 13 Dec 2012 22:32:06 +0100 Krzysztof wrote: > Hi, > > I know that in normal cases those things has no matters, but I do much > things in OnPaint so each millisecond is matter. For example, strings > comparisons: > > What is faster if string is "big": > > if s'' then.... > > or: > > if Length(s)>0 then... The first. > Same thing with incrementations: > > i := i + 1 > > or: > > Inc(i) > > or: > > i += 1; All the same. Mattias _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email