Hi John, Hi All,<div><br></div><div> I'm in Mac OS platform land right now and have become alarmed, possibly unnecessarily, about the run-time cost of the lookup in the Mac threaded GUI scheme, e.g. in the following</div>
<div><br></div><div><div> void *giLocker;</div><div> int return_value=0;</div><div><br></div><div> giLocker = interpreterProxy->ioLoadFunctionFrom("getUIToLock", "");</div><div> if (giLocker != 0) {</div>
<div> sqInt foo[7];</div><div> foo[0] = 4;</div><div> foo[1] = (sqInt) MoveWindow;</div><div> foo[2] = (sqInt) windowHandleFromIndex(windowIndex);</div><div> foo[3] = x;</div><div> foo[4] = y;</div>
<div> foo[5] = true;</div><div> foo[6] = 0;</div><div> ((sqInt (*) (void *)) giLocker)(foo);</div><div> return_value = interpreterProxy->positive32BitIntegerFor(foo[6]);</div><div> }</div>
<div><br></div></div><div>isn't the lookup in ioLoadFunctionFrom expensive? Shouldn't we instead be writing</div><div><br></div><div><div>static void *giLocker = 0;</div><div><br></div><div>...</div><div>int myfunc()</div>
<div>{</div><div> int return_value=0;</div><div><br></div><div> if (!guiLocker)</div><div> giLocker = interpreterProxy->ioLoadFunctionFrom("getUIToLock", "");</div><div> if (giLocker) {</div>
<div> sqInt foo[7];</div><div> foo[0] = 4;</div><div> foo[1] = (sqInt) MoveWindow;</div><div> foo[2] = (sqInt) windowHandleFromIndex(windowIndex);</div><div> foo[3] = x;</div><div> foo[4] = y;</div>
<div> foo[5] = true;</div><div> foo[6] = 0;</div><div> ((sqInt (*) (void *)) giLocker)(foo);</div><div> return_value = interpreterProxy->positive32BitIntegerFor(foo[6]);</div><div> }</div>
</div><div><br></div><div>?</div><div><br></div><div>And if not, why not?</div><div><br></div><div>best</div><div>Eliot</div>