<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta content="MSHTML 6.00.6000.16735" name="GENERATOR">
<style title="owaParaStyle">P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</style>
</head>
<body ocsi="x">
<div dir="ltr"><font face="Tahoma" color="#000000" size="2">Does it also repro under a debugger?&nbsp; Given it's a full 5 seconds could you pause the app when this is happening to see what the actual stacks are?&nbsp;
</font></div>
<div dir="ltr"><font face="tahoma" size="2"></font>&nbsp;</div>
<div id="divRpF719037" style="DIRECTION: ltr">
<hr tabindex="-1">
<font face="Tahoma" size="2"><b>From:</b> users-bounces@lists.ironpython.com [users-bounces@lists.ironpython.com] On Behalf Of Glenn Jones [glenn.k.jones&#43;ipy@gmail.com]<br>
<b>Sent:</b> Tuesday, November 25, 2008 10:40 AM<br>
<b>To:</b> Curt Hagenlocher<br>
<b>Cc:</b> Discussion of IronPython<br>
<b>Subject:</b> Re: [IronPython] Question about Control.Invoke and CallTargets<br>
</font><br>
</div>
<div></div>
<div>We only see the long pause in IP2. To give a feeling of magnitude:<br>
<br>
* The first recalc of Resolver (without user input) takes ~3500ms, almost the same as IP1<br>
* The first recalc with user input that hits this issue takes ~5000ms<br>
* Recalcs after that take ~400ms, which is on par with IP1<br>
<br>
Interestingly, removing the form.Invoke and calling it directly (as a test), removed the pause from that place, but it introduced it at a later stage, where we ask our grid component to refresh itself, which probably uses a cross thread invocation itself.<br>
<br>
CheckForIllegalCrossThreadCalls is turned off, but we enable it when running tests, so we know we don't actually do any (except that experiment above).<br>
<br>
Glenn &amp; Orestis<br>
<br>
<br>
<div class="gmail_quote">On Tue, Nov 25, 2008 at 3:57 PM, Curt Hagenlocher <span dir="ltr">
&lt;<a href="mailto:curt@hagenlocher.org">curt@hagenlocher.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
Is this something that changed between 1.1 and 2.0 or do you see the same behavior in both?<br>
<br>
<div class="gmail_quote">
<div>
<div></div>
<div class="Wj3C7c">On Tue, Nov 25, 2008 at 7:47 AM, Glenn Jones <span dir="ltr">
&lt;<a href="mailto:glenn.k.jones%2Bipy@gmail.com">glenn.k.jones&#43;ipy@gmail.com</a>&gt;</span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<div>
<div></div>
<div class="Wj3C7c">Hello guys,<br>
<br>
We're seeing some strange behaviour when doing cross-thread invoking in Resolver. Unfortunately, we can't get a minimal repro for this, so I'll just describe what's going on and hopefully something will be obvious.<br>
<br>
We do our recalcs in a background thread, to avoid blocking the GUI. When a recalc finishes, it has to update the UI with the results of the calculations. We do that with:<br>
<br>
<br>
&nbsp;&nbsp;&nbsp; form.Invoke(self._synchroniseUI.Target, self, startedTime, aborted, state)<br>
<br>
where 'form' is our main form, 'self' is a Document instance that holds the sub-engine and all the results, `startedTime` is a DateTime, `aborted` is a ManualResetEvent, and `state` is an object with some state extracted from the recalculations.<br>
<br>
We have instrumented the execution of this, and we find this weird pattern: While _synchroniseUI takes say 500ms, form.Invoke takes 5000ms, but only the first time it's called. Subsequent updates behave normally. Our guess would be that some kind of overhead
 is created lazily once, and comes for free after that, but it's hard to see what's going on.<br>
<br>
We've tried the same Invoke call with CallTarget0 and a lambda with the arguments and with CallTarget5 with the same results.<br>
<br>
Is there something potentially expensive that involves CallTargets and cross-thread invocations? This was fine in IronPython 1.1.<br>
<br>
Thanks<br>
Glenn &amp; Orestis<br>
<br>
<br>
<br>
</div>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br>
</blockquote>
</div>
<br>
</blockquote>
</div>
<br>
</div>
</body>
</html>