<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>I have noticed a huge drop of performance while testing Qgis
      server with Qgis 3.26, from 10x to 30x slower as usual.</p>
    <p>Trying to reduce the problem I have found a huge increase of time
      spend reading the project in 3.26 compared to 3.24.</p>
    <p>Here some benchmark with very simple project from the test data
      set. Note: the project has been updated with qgis 3.26:</p>
    <p>Qgis 3.24:<br>
      ======<br>
    </p>
    <div class="inner_cell">
      <div class="input_area" aria-label="Edit code here">
        <div class="CodeMirror cm-s-ipython">
          <div style="overflow: hidden; position: relative; width: 3px;
            height: 0px; top: 73.6px; left: 569.033px;"><textarea style="position: absolute; bottom: -1em; padding: 0px; width: 1px; height: 1em; outline: currentcolor none medium;" spellcheck="false" tabindex="0" wrap="off"></textarea></div>
          <div class="CodeMirror-scroll" tabindex="-1" draggable="true">
            <div class="CodeMirror-sizer" style="margin-left: 0px;
              min-width: 572.033px; margin-bottom: 0px;
              border-right-width: 50px; min-height: 96px; padding-right:
              0px; padding-bottom: 0px;">
              <div style="position: relative; top: 0px;">
                <div class="CodeMirror-lines" role="presentation">
                  <div style="position: relative; outline: currentcolor
                    none medium;" role="presentation">
                    <div class="CodeMirror-code" role="presentation"
                      style="">
                      <pre class=" CodeMirror-line " role="presentation"><span role="presentation"><span class="cm-variable">readflags</span> <span class="cm-operator">=</span> <span class="cm-variable">QgsProject</span>.<span class="cm-property">ReadFlags</span>()<span class="cm-variable">
readflags</span> <span class="cm-operator">|=</span> <span class="cm-variable">QgsProject</span>.<span class="cm-property">FlagTrustLayerMetadata</span></span></pre>
                      <pre class=" CodeMirror-line " role="presentation"><span role="presentation"><span></span><span class="cm-variable">prj</span> <span class="cm-operator">=</span> <span class="cm-variable">QgsProject</span>()</span></pre>
                      <pre class=" CodeMirror-line " role="presentation"><span role="presentation"><span class="cm-operator">%</span><span class="cm-variable">timeit</span> <span class="cm-operator">-</span><span class="cm-variable">n</span> <span class="cm-number">1</span> <span class="cm-variable">prj</span>.<span class="cm-property">read</span>(<span class="cm-string">f"</span>{<span class="cm-variable">datapath</span>}<span class="cm-string">/france_parts.qgs"</span>,<span class="cm-variable">readflags</span>)</span></pre>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="output_subarea output_text output_stream output_stdout"
      dir="auto">
      <pre>> 15.7 ms ± 205 µs per loop (mean ± std. dev. of 7 runs, 1 loop each)
</pre>
    </div>
    <p>Qgis 3.26:<br>
      ======</p>
    <div class="CodeMirror-code" role="presentation" style="">
      <pre class=" CodeMirror-line " role="presentation"><span role="presentation"><span class="cm-variable">readflags</span> <span class="cm-operator">=</span> <span class="cm-variable">QgsProject</span>.<span class="cm-property">ReadFlags</span>()
<span class="cm-variable">readflags</span> <span class="cm-operator">|=</span> <span class="cm-variable">QgsProject</span>.<span class="cm-property">FlagTrustLayerMetadata</span></span></pre>
      <pre class=" CodeMirror-line " role="presentation"><span role="presentation"><span>​</span><span class="cm-variable">prj</span> <span class="cm-operator">=</span> <span class="cm-variable">QgsProject</span>()</span></pre>
      <pre class=" CodeMirror-line " role="presentation"><span role="presentation"><span class="cm-operator">%</span><span class="cm-variable">timeit</span> <span class="cm-operator">-</span><span class="cm-variable">n</span> <span class="cm-number">1</span> <span class="cm-variable">prj</span>.<span class="cm-property">read</span>(<span class="cm-string">f"</span>{<span class="cm-variable">datapath</span>}<span class="cm-string">/france_parts.qgs"</span>,<span class="cm-variable">readflags</span>)</span></pre>
    </div>
    <div class="output_subarea output_text output_stream output_stdout"
      dir="auto">
      <pre>195 ms ± 44 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
</pre>
      <p>There is a factor x10 between Qgis 3.24 et Qgis 3.26 for the
        exact same project. <br>
        This has serious impact on requests: landing page catalog
        request time increased from approximatevely 110ms to more than
        3.0s with our test data set.</p>
      <br>
    </div>
    <div class="moz-signature">
      <p> <span style="font-weight:bold;color:#9ACD32;">David Marteau</span>
        <br>
        <!-- Responsable Infrastructure <br> -->
        <a href="http://www.3liz.com" style="text-decoration:
          none;color: #9ACD32;">www.3liz.com</a> <br>
        <span style="font-size:0.8em;"> </span>
      </p>
    </div>
  </body>
</html>