<div dir="ltr">Hi Esteban,<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 22, 2015 at 10:32 AM, Esteban Lorenzano <span dir="ltr">&lt;<a href="mailto:estebanlm@gmail.com" target="_blank">estebanlm@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div style="word-wrap:break-word">I’m just trying to understand the cost difference between prim 120 and #primitiveCalloutWithArgs so it should be easy to set up a test :)<div>but… judging #primitiveDoNamedPrimitiveWithArgs… I suppose something like Athens will need a numbered primitive, in order to keep it performant…</div></div></blockquote><div><br></div><div>What Tim said.  Both the Interpreter and the Cogit go to some lengths to cache named primtiiev calls so that the complex linking machinery is used only on the first call.  In particular primitiveDoNamedPrimitiveWithArgs is used only in the debugger to call named primitives.  It *isn&#39;t* used at all in a normal named primitive call.  Only primitiveExternalCall is used on the *first* invocation of a named primitive.  Subsequent invocations likely invoke the primitive directly.  If the named primitive gets dropped from the method cache (or for generated code) but the plugin module has not been unloaded then the function pointer will still be in the named primitive&#39;s first literal and will be fetched from there, and the method lookup cache updated to point to the function pointer, avoiding any need to lookup the name in the plugin module.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>but well, after I have numbers I will send a proposition (if needed), to remap #primitiveCalloutWithArgs into a number… :P<br></div></div></blockquote><div><br></div><div>Like I said earlier in the thread, the issue is likely not to do with numbers.  It is to do with providing the right flags as the result of primitivePropertyFlagsForSpur: &amp; primitivePropertyFlagsForV3: so that the Cogit can generate code that is robust in the face of callbacks.  See SimpleStackBasedCogit&gt;&gt;#compileInterpreterPrimitive:</div><div><br></div><div><br></div><div>HTH</div><div><br></div><div>P.S.  Great that you&#39;re working on the FFI!!</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div></div><div><br></div><div>Esteban</div><div><br></div><div><div><br><div><blockquote type="cite"><div>On 22 Jun 2015, at 19:16, Clément Bera &lt;<a href="mailto:bera.clement@gmail.com" target="_blank">bera.clement@gmail.com</a>&gt; wrote:</div><br><div><div dir="ltr">Well it also depends if the primitive is generated by the JIT. If you rewrite SmallInteger&gt;&gt;#+ from primitive 1 to a named primitive the overhead will be more important than just the <span style="font-size:12.8000001907349px">searching/loading/linking because the JIT won&#39;t compile it to n-code anymore.</span><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">So make a test with a primitive not compiled by the JIT.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-06-22 18:35 GMT+02:00 David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
That sounds right to me too. But it would be a worthwhile experiment to<br>
set up a test to confirm it. Maybe take one or more methods that call<br>
numbered primitives, and recode them to call the primitives by name. Then<br>
measure and see if anything got slower.<br>
<br>
Dave<br>
<div><div><br>
&gt;<br>
&gt; On 22-06-2015, at 5:13 AM, Esteban Lorenzano &lt;<a href="mailto:estebanlm@gmail.com" target="_blank">estebanlm@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi,<br>
&gt;&gt;<br>
&gt;&gt; Any idea how slower is? I mean, any measure/estimation/something around?<br>
&gt;<br>
&gt; After the initial searching/loading/linking it should be pretty much<br>
&gt; identical. It’s just a jump to a pointed-at program location.<br>
&gt;<br>
&gt;<br>
&gt; tim<br>
&gt; --<br>
&gt; tim Rowledge; <a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" rel="noreferrer" target="_blank">http://www.rowledge.org/tim</a><br>
&gt; Useful random insult:- Ready to check in at the HaHa Hilton.<br>
&gt;<br>
&gt;<br>
<br>
<br>
</div></div></blockquote></div><br></div>
</div></blockquote></div><br></div></div></div><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">best,<div>Eliot</div></div>
</div></div>