<div dir="auto">Thanks, Phil<div dir="auto"><br></div><div dir="auto">I supposed it too late, no problem for openjdk21.</div><div dir="auto"><br></div><div dir="auto">I made a draft PR and tested several sizes on 1 machine:</div><div dir="auto"><a href="https://github.com/openjdk/jdk/pull/11569">https://github.com/openjdk/jdk/pull/11569</a><br></div><div dir="auto"><br></div><div dir="auto">Of course I can complete later with more tested machines & using j2dbench if needed.</div><div dir="auto"><br></div><div dir="auto">I can also give ratios... ie gains.</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Laurent</div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 7 déc. 2022, 19:22, Philip Race <<a href="mailto:philip.race@oracle.com">philip.race@oracle.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
  <div>
    This is clearly too late for JDK 20 and JDK 21 will be just 6 months
    later so it is a better time for that.<br>
    FWIW we have just had at a report of a performance drop in JDK 20
    from a b07 change to show how it takes<br>
    time for these things to be discovered.<br>
    Also I had a bug / rfe for this a while back :
    <a href="https://bugs.openjdk.org/browse/JDK-8233037" target="_blank" rel="noreferrer">https://bugs.openjdk.org/browse/JDK-8233037</a><br>
    I closed it as WNF because I wasn't able to see a performance boost.<br>
    <br>
    So the right way to do this is  to provide some solid evidence of
    what gets faster and what gets<br>
    slower with a range of different values (not just the JBR one) and
    re-open that bug and resolve early in 21.<br>
    <br>
    -phil.<br>
    <br>
    <br>
    <div>On 12/7/22 7:36 AM, Alexey Ushakov
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      Yes, I confirm that we’ve been using such enlarged buffer for a
      long time in production. It helped us with scrolling performance
      on 4K monitors. The suggested property could help to adjust the
      buffer for the needs of particular application.
      <div><br>
      </div>
      <div>Best Regards,</div>
      <div>Alexey<br>
        <div><br>
          <blockquote type="cite">
            <div>On 7 Dec 2022, at 11:37, Laurent Bourgès <<a href="mailto:bourges.laurent@gmail.com" target="_blank" rel="noreferrer">bourges.laurent@gmail.com</a>>
              wrote:</div>
            <br>
            <div>
              <div dir="auto">Hi,
                <div dir="auto"><br>
                  <div dir="auto">For years, JetBrains Runtime
                    uses a larger render queue buffer size (32kb to
                    6,400,000 bytes) in production, as it boosted many
                    accelerated pipelines: d3d, ogl, metal :</div>
                  <div dir="auto">~ 10 to 20% on large fills...</div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">JBR RenderQueue:</div>
                  <div dir="auto"><a href="https://github.com/JetBrains/JetBrainsRuntime/blob/02bc54f8644c6c6467aa952d0a8a104355acc273/src/java.desktop/share/classes/sun/java2d/pipe/RenderQueue.java#L75" target="_blank" rel="noreferrer">https://github.com/JetBrains/JetBrainsRuntime/blob/02bc54f8644c6c6467aa952d0a8a104355acc273/src/java.desktop/share/classes/sun/java2d/pipe/RenderQueue.java#L75</a><br>
                  </div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">JDK RenderQueue:</div>
                  <div dir="auto"><a href="https://github.com/bourgesl/jdk-official/blob/5e196b4b8e623107424e2fb54672790fd925fe73/src/java.desktop/share/classes/sun/java2d/pipe/RenderQueue.java#L75" target="_blank" rel="noreferrer">https://github.com/bourgesl/jdk-official/blob/5e196b4b8e623107424e2fb54672790fd925fe73/src/java.desktop/share/classes/sun/java2d/pipe/RenderQueue.java#L75</a><br>
                  </div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">I want to propose such quick
                    fix in openjdk20 today, as a 1-line fix.</div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">
                    <table>
                      <tbody>
                        <tr>
                          <td>
                            <br>
                          </td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td> /** The size of the underlying
                            buffer, in bytes. */</td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td> private static final int
                            BUFFER_SIZE = 6400000;</td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">To ensure a smooth
                    transition, I prefer introducing a new
                    sun.java2d.render.queue system property to increase
                    the default (32kb) buffer capacity:</div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">See in marlin:</div>
                  <div dir="auto"><a href="https://github.com/bourgesl/marlin-renderer/blob/323f1fb1c72704f5e86c8a13393e30df00888821/src/main/java/sun/java2d/pipe/RenderQueue.java#L78" target="_blank" rel="noreferrer">https://github.com/bourgesl/marlin-renderer/blob/323f1fb1c72704f5e86c8a13393e30df00888821/src/main/java/sun/java2d/pipe/RenderQueue.java#L78</a><br>
                  </div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">So here is my current
                    proposal:</div>
                  <div dir="auto">[[[</div>
                  <div dir="auto">
                    <table>
                      <tbody>
                        <tr>
                          <td>
                            <br>
                          </td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td> /** The size of the underlying
                            buffer, in bytes. */</td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td> private static final int
                            BUFFER_SIZE;</td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td>
                            <br>
                          </td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td> static {</td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td> // Default 32K is too small for
                            high-end GPU:</td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td> BUFFER_SIZE =
                            align(getInteger("sun.java2d.render.bufferSize",
                            32 * 1024, 32 * 1024, 16 * 1024 * 1024),
                            1024);</td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td>
                            <br>
                          </td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td>//
                            System.out.println("RenderQueue:
                            sun.java2d.render.bufferSize = " +
                            BUFFER_SIZE);</td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                    <table>
                      <tbody>
                        <tr>
                          <td> }</td>
                        </tr>
                        <tr>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">    // system property
                    utilities</div>
                  <div dir="auto">    public static int
                    getInteger(final String key, final int def,</div>
                  <div dir="auto">                             
                       final int min, final int max)</div>
                  <div dir="auto">    {</div>
                  <div dir="auto">        final String property
                    = AccessController.doPrivileged(</div>
                  <div dir="auto">                             
                          new GetPropertyAction(key));</div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">        int value = def;</div>
                  <div dir="auto">        if (property != null)
                    {</div>
                  <div dir="auto">            try {</div>
                  <div dir="auto">                value =
                    Integer.decode(property);</div>
                  <div dir="auto">            } catch
                    (NumberFormatException e) {</div>
                  <div dir="auto">               
                    System.out.println("Invalid integer value for " +
                    key + " = " + property);</div>
                  <div dir="auto">            }</div>
                  <div dir="auto">        }</div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">        // check for invalid
                    values</div>
                  <div dir="auto">        if ((value < min)
                    || (value > max)) {</div>
                  <div dir="auto">           
                    System.out.println("Invalid value for " + key + " =
                    " + value</div>
                  <div dir="auto">                    + ";
                    expected value in range[" + min + ", " + max + "]
                    !");</div>
                  <div dir="auto">            value = def;</div>
                  <div dir="auto">        }</div>
                  <div dir="auto">        return value;</div>
                  <div dir="auto">    }</div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">    protected static int
                    align(final int val, final int norm) {</div>
                  <div dir="auto">        final int ceil =
                    (int)Math.ceil( ((float) val) / norm);</div>
                  <div dir="auto">        return ceil * norm;</div>
                  <div dir="auto">    }</div>
                  <div dir="auto">]]]</div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">Would you accept such late
                    change for openjdk20 ?</div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">Cheers,</div>
                  <div dir="auto">Laurent Bourgès </div>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div>