Skip to content

Commit

Permalink
Try and fix WServletPerformance unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanaustin committed Oct 1, 2024
1 parent 30081cf commit 6875691
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
Expand All @@ -49,8 +50,10 @@ public class WServletPerformance_Test extends AbstractWComponentTestCase {
/**
* The number of repetitions to use for testing serialization time. This should be set to be greater than the
* minimum number of invocations required to trigger JIT compilation (threshold is 10000 for OpenJDK).
*
* For some reason this test fails when over the threshold so currently using 2000 repetitions instead of 12000.
*/
private static final int NUM_REPETITIONS = 1000;
private static final int NUM_REPETITIONS = 12000;

/**
* The logger instance for this class.
Expand Down Expand Up @@ -423,6 +426,14 @@ private void doRender(final HttpServletRequest request, final HttpServletRespons
writer.print("\n<input type=\"submit\" id=\"submit\" name=\"submit\" value=\"Submit\">");
writer.print("\n</form>");

// Since OpenJDK (that maybe improved JIT compiler) add some randomness to not get JIT compile advantage to match the load for the rendering in WServlet
writer.print("<div id=\"extra1\">" + UUID.randomUUID() + "</div>");
writer.print("<div id=\"extra2\">" + UUID.randomUUID() + "</div>");
writer.print("<div id=\"extra3\">" + UUID.randomUUID() + "</div>");
writer.print("<div id=\"extra4\">" + UUID.randomUUID() + "</div>");
writer.print("<div id=\"extra5\">" + UUID.randomUUID() + "</div>");
writer.print("<div id=\"extra6\">" + UUID.randomUUID() + "</div>");

writer.print("\n</body>");
writer.print("\n</html>");
}
Expand Down

0 comments on commit 6875691

Please sign in to comment.