<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="moz-cite-prefix">On 12/01/2024 22:46, Maurizio
Cimadamore wrote:<br>
</div>
<blockquote type="cite" cite="mid:524b5ab3-29eb-4525-9e50-cd6438cc7710@oracle.com">
<div class="moz-cite-prefix">On 12/01/2024 19:34, Pedro LamarĂ£o
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAC8PkgEuv4dRQYNSTyD1crbBys1kYvMWANk8OEUo=ZUDxfPmnA@mail.gmail.com">
<div dir="ltr">...<br>
<div class="gmail_quote">
<div>May I suggest that the following be added to the
Javadoc?</div>
<div>It is already stated that it is advised that critical
downcalls be "extremely fast".</div>
<div>I suggest adding that they should run in a predictable,
"constant" amount of time.</div>
</div>
</div>
</blockquote>
I agree that the text could be improved - however we don't say
"fast" - we say this:<br>
<p> </p>
<blockquote type="cite">
<p> A critical function is a function that has an extremely
short running time in all cases (similar to calling an empty
function), and does not call back into Java (e.g. using an
upcall stub). </p>
</blockquote>
I agree that talking about "constant" or "predictable" execution
time would perhaps be a better characterization.</blockquote>
<br>
<p>This is what the "in all cases" is meant to convey. i.e. if in <i>some</i>
cases the function doesn't have an extremely short running time,
it should not be marked critical.</p>
<p>But, I think the best advice is: don't just use critical()
anywhere that you can, use it only in places where you absolutely
need it. As Maurizio said as well, the difference when using
critical() is very small, but it blocks the rest of the JVM from
doing its job (not only the GC, but also other
safepoint-/handshake-based operations). So, I'd say the right way
to use critical() is to measure your application with a profiler,
when you find a bottleneck that is a native function call, and
that function fits the critical() criteria, then apply the
critical() linker option to that function, and if you actually see
a performance improvement, then keep using it.</p>
<p>Jorn<br>
</p>
</body>
</html>