<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><font face="monospace">Hi!</font></p>
    <p><font face="monospace">Fun question -- and a perfect use-case for
        the <a moz-do-not-send="true"
          href="https://opensips.org/docs/modules/3.6.x/benchmark.html">benchmark</a>
        module, allowing you to find the precise answer to this question
        and also share it with us!</font></p>
    <p><font face="monospace">While the dialplan uses a hash table to
        store its string-based rules, unfortunately it seems to be
        hardcoded to <b>16</b> (???).  Which means on 1M records, you
        will get 62K on each bucket on average.  Now, imagine doing
        ->next, ->next, ->next, etc. 62K times on each number
        lookup...  So I think performance will be decent since C lang is
        fast, but far from ideal.  The hash size should be <i>configurable</i>
        <i>- </i>an excellent feature request for people getting into
        OpenSIPS development.<br>
      </font></p>
    <p><font face="monospace">OTOH, the sql_cacher uses cachedb_local to
        store/pull its keys, which has a much wider hash size (IIRC, <b>1024</b>
        buckets).  So I think it will be visibly faster than dialplan
        when doing 1M lookups over 1M records.</font></p>
    <p><font face="monospace">Best regards,<br>
      </font></p>
    <div class="moz-cite-prefix">On 03.05.2025 12:27, M S wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAEZrhoPNvGPFRydA2s=Vg0HcwQ=pYWEfHCarnoA-8v8RajHpFg@mail.gmail.com">
      <div>How better is it to use a </div>
      <div>for(i=0 to 1000000) {</div>
      <div>  if($sql_cached_value(c_features:disabled:$fU)<>NULL
        || $sql_cached_value(c_features:disabled:$rU)) {</div>
      <div>      send_reply(503);</div>
      <div>  }</div>
      <div>}</div>
      <div><br>
      </div>
      <div>instead of just a:</div>
      <div><br>
      </div>
      <div>if(dp_translate($fU) || dp_translate($rU)) {</div>
      <div>  send_reply(503);</div>
      <div>}</div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Liviu Chircu
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a> | <a class="moz-txt-link-abbreviated" href="http://www.siphub.com">www.siphub.com</a></pre>
  </body>
</html>