[DUG] Curious re efficiency of using in [set of integer]

Ross Levis ross at stationplaylist.com
Mon Aug 15 18:11:09 NZST 2022


I should do that.

 

It may matter if it’s converting to something expensive code in ASM, and this code is being executed a few thousand times.

 

From: delphi-bounces at listserver.123.net.nz [mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Rohit Gupta
Sent: Monday, 15 August 2022 6:01 pm
To: NZ Borland Developers Group - Delphi List
Cc: delphi at delphi.org.nz
Subject: Re: [DUG] Curious re efficiency of using in [set of integer]

 

Just put it in a loop of 10k and time it. 

But honestly, does it really matter? 

Regards 
Rohit 

 

15/08/2022 17:34:14 Ross Levis <ross at stationplaylist.com>:

Var Total: Integer;

If I want to test 2 or 3 values of an integer, I often use

if Total in [4,6] then ...

But is that more or less efficient for the CPU/ASM coding than

if (Total = 4) or (Total = 6) then ...

I’m not sure how to find out myself.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20220815/3af58cb3/attachment-0003.html 


More information about the Delphi mailing list