<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Ross, that was my expectation, that the SET would be slightly
      faster.  <br>
    </p>
    <p>The <font size="6"><b>set </b></font>should <b>fetch </b>the
      data, <b>shift </b>it and <b>and </b>it.</p>
    <p>Where as the <font size="6"><b>or </b></font>should <b>fetch </b>the
      data and execute two <b>compare </b>and <b>jump </b>type
      instructions.</p>
    <p>In this case, I doubt if the optimisation would make much
      difference.  Optimisation make a significant difference to loops
      and where a variable/constant is used again and again.<br>
    </p>
    <div class="moz-signature"
      signature-switch-id="3e964606-e7ce-403a-b282-9d34cad6084e">
      <p>
        Regards<br>
        <br>
        <b>Rohit Gupta</b><br>
        B.E. Elec., M.E., Mem IEEE, Member IET<br>
        <br>
      </p>
    </div>
    <div class="moz-cite-prefix">On 15/08/2022 22:51, Ross Levis wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:004f01d8b094$f745e130$e5d1a390$@com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 12 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I
            did the test but had to use a loop 40000000 times to get
            some separation.  The in set statement was actually faster
            than doing 2 “or” statements.  Around 76 to 65 ticks. 
            Basically identical and both too fast to be concerned with.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"
                  lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"
                lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
                [<a class="moz-txt-link-freetext" href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>] <b>On
                  Behalf Of </b>Ross Levis<br>
                <b>Sent:</b> Monday, 15 August 2022 6:11 pm<br>
                <b>To:</b> 'NZ Borland Developers Group - Delphi List'<br>
                <b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
                <b>Subject:</b> Re: [DUG] Curious re efficiency of using
                in [set of integer]<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I
            should do that.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">It
            may matter if it’s converting to something expensive code in
            ASM, and this code is being executed a few thousand times.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"
                  lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"
                lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:delphi-bounces@listserver.123.net.nz">delphi-bounces@listserver.123.net.nz</a>
                [<a class="moz-txt-link-freetext" href="mailto:delphi-bounces@listserver.123.net.nz">mailto:delphi-bounces@listserver.123.net.nz</a>] <b>On
                  Behalf Of </b>Rohit Gupta<br>
                <b>Sent:</b> Monday, 15 August 2022 6:01 pm<br>
                <b>To:</b> NZ Borland Developers Group - Delphi List<br>
                <b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a><br>
                <b>Subject:</b> Re: [DUG] Curious re efficiency of using
                in [set of integer]<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <p class="MsoNormal"><span
              style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">Just
              put it in a loop of 10k and time it. <br>
              <br>
              But honestly, does it really matter? <o:p></o:p></span></p>
        </div>
        <div>
          <p class="MsoNormal">Regards <br>
            Rohit <o:p></o:p></p>
        </div>
        <div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <div>
            <p>15/08/2022 17:34:14 Ross Levis
              <a class="moz-txt-link-rfc2396E" href="mailto:ross@stationplaylist.com">&lt;ross@stationplaylist.com&gt;</a>:<o:p></o:p></p>
          </div>
          <blockquote style="border:none;border-left:solid #CCCCCC
            1.5pt;padding:0cm 0cm 0cm
6.0pt;margin-left:0cm;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Var
                Total: Integer;</span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">If
                I want to test 2 or 3 values of an integer, I often use</span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">if
                  Total in [4,6] then ...</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">But
                is that more or less efficient for the CPU/ASM coding
                than</span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">if
                  (Total = 4) or (Total = 6) then ...</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
            <p class="MsoNormal"
              style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span
style="font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I’m
                not sure how to find out myself.</span><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"><o:p></o:p></span></p>
          </blockquote>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</pre>
    </blockquote>
  </body>
</html>