<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Pause for the better	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/pause-for-the-better/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/pause-for-the-better?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pause-for-the-better</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Thu, 09 May 2019 08:25:29 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.3</generator>
	<item>
		<title>
		By: Dima		</title>
		<link>https://undocumentedmatlab.com/articles/pause-for-the-better#comment-477279</link>

		<dc:creator><![CDATA[Dima]]></dc:creator>
		<pubDate>Thu, 09 May 2019 08:25:29 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3093#comment-477279</guid>

					<description><![CDATA[Hey Yair, 
As you said, in the new MATLAB versions the pause performs the same or even better for some pause duration. The interesting thing is that for time duration in between &#062;1ms and &#060;10ms Java&#039;s sleep performs better (see a table below) but for duration less than equal to 1ms MATLAB the opposite is true.
Do you have any idea why is this? 
Also does it make any sense at all to measure pausing time for duration less than 1ms? (Can tic/toc give reliable values for this small time period?) 
============================================================
Pausing Time = 10ms : 
pause() : Median = 5.6129 Mean = 5.3252 Max = 12.1966
sleep() : Median = 5.6125 Mean = 5.4652 Max = 14.849  
============================================================
Pausing Time = 7ms : 
pause() : Median = 8.6154 Mean = 7.7185 Max = 14.0192
sleep() : Median = 0.3767 Mean = 0.60192 Max = 1.3815
============================================================
Pausing Time = 5ms : 
pause() : Median = 10.6026 Mean = 8.8543 Max = 15.4677
sleep() : Median = 0.38281 Mean = 0.57611 Max = 1.4071
============================================================
Pausing Time = 1ms : 
pause() : Median = 0.0076145 Mean = 0.015155 Max = 0.31958
sleep() : Median = 0.34215 Mean = 0.53122 Max = 1.5084
============================================================]]></description>
			<content:encoded><![CDATA[<p>Hey Yair,<br />
As you said, in the new MATLAB versions the pause performs the same or even better for some pause duration. The interesting thing is that for time duration in between &gt;1ms and &lt;10ms Java&#039;s sleep performs better (see a table below) but for duration less than equal to 1ms MATLAB the opposite is true.<br />
Do you have any idea why is this?<br />
Also does it make any sense at all to measure pausing time for duration less than 1ms? (Can tic/toc give reliable values for this small time period?)<br />
============================================================<br />
Pausing Time = 10ms :<br />
pause() : Median = 5.6129 Mean = 5.3252 Max = 12.1966<br />
sleep() : Median = 5.6125 Mean = 5.4652 Max = 14.849<br />
============================================================<br />
Pausing Time = 7ms :<br />
pause() : Median = 8.6154 Mean = 7.7185 Max = 14.0192<br />
sleep() : Median = 0.3767 Mean = 0.60192 Max = 1.3815<br />
============================================================<br />
Pausing Time = 5ms :<br />
pause() : Median = 10.6026 Mean = 8.8543 Max = 15.4677<br />
sleep() : Median = 0.38281 Mean = 0.57611 Max = 1.4071<br />
============================================================<br />
Pausing Time = 1ms :<br />
pause() : Median = 0.0076145 Mean = 0.015155 Max = 0.31958<br />
sleep() : Median = 0.34215 Mean = 0.53122 Max = 1.5084<br />
============================================================</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/pause-for-the-better#comment-435790</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 16 Aug 2018 11:35:28 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3093#comment-435790</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/pause-for-the-better#comment-435782&quot;&gt;Sometalk&lt;/a&gt;.

In recent Matlab releases, Matlab&#039;s &lt;i&gt;&lt;b&gt;pause&lt;/b&gt;&lt;/i&gt; is no less (sometimes even more) accurate than Java&#039;s &lt;code&gt;Thread.sleep&lt;/code&gt;, with a consistent mean inaccuracy (overhead) of 0.1-0.2 ms and max inaccuracy of ~1ms, regardless of the pause duration. These values depend of course on the specific OS and CPU, so YMMV.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/pause-for-the-better#comment-435782">Sometalk</a>.</p>
<p>In recent Matlab releases, Matlab&#8217;s <i><b>pause</b></i> is no less (sometimes even more) accurate than Java&#8217;s <code>Thread.sleep</code>, with a consistent mean inaccuracy (overhead) of 0.1-0.2 ms and max inaccuracy of ~1ms, regardless of the pause duration. These values depend of course on the specific OS and CPU, so YMMV.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Sometalk		</title>
		<link>https://undocumentedmatlab.com/articles/pause-for-the-better#comment-435782</link>

		<dc:creator><![CDATA[Sometalk]]></dc:creator>
		<pubDate>Thu, 16 Aug 2018 09:53:03 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3093#comment-435782</guid>

					<description><![CDATA[Have you rerun this benchmark more recently? I wonder if there have been any improvements in this space.]]></description>
			<content:encoded><![CDATA[<p>Have you rerun this benchmark more recently? I wonder if there have been any improvements in this space.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Take a break, have a pause() &#124; matlabideas		</title>
		<link>https://undocumentedmatlab.com/articles/pause-for-the-better#comment-203570</link>

		<dc:creator><![CDATA[Take a break, have a pause() &#124; matlabideas]]></dc:creator>
		<pubDate>Sat, 18 May 2013 14:54:49 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3093#comment-203570</guid>

					<description><![CDATA[[...] time ago my colleague showed me an article from Undocumented MATLAB that argues in favour of the Java Thread.sleep() function instead of the MATLAB pause() [...]]]></description>
			<content:encoded><![CDATA[<p>[&#8230;] time ago my colleague showed me an article from Undocumented MATLAB that argues in favour of the Java Thread.sleep() function instead of the MATLAB pause() [&#8230;]</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Solving a Matlab hang problem &#124; Undocumented Matlab		</title>
		<link>https://undocumentedmatlab.com/articles/pause-for-the-better#comment-153167</link>

		<dc:creator><![CDATA[Solving a Matlab hang problem &#124; Undocumented Matlab]]></dc:creator>
		<pubDate>Wed, 06 Feb 2013 18:01:38 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3093#comment-153167</guid>

					<description><![CDATA[[...] a reader&#039;s comment yesterday happened on the same page where I explained the problem and solution [...]]]></description>
			<content:encoded><![CDATA[<p>[&#8230;] a reader&#8217;s comment yesterday happened on the same page where I explained the problem and solution [&#8230;]</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Marc		</title>
		<link>https://undocumentedmatlab.com/articles/pause-for-the-better#comment-152359</link>

		<dc:creator><![CDATA[Marc]]></dc:creator>
		<pubDate>Tue, 05 Feb 2013 11:38:40 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3093#comment-152359</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/pause-for-the-better#comment-152329&quot;&gt;Marc&lt;/a&gt;.

As far as I can see, &lt;i&gt;&lt;b&gt;pause()&lt;/b&gt;&lt;/i&gt; calls (a part of) &lt;i&gt;&lt;b&gt;drawnow&lt;/b&gt;&lt;/i&gt; to flush the queue. Interesting: with Process Explorer I found that &lt;i&gt;&lt;b&gt;pause()&lt;/b&gt;&lt;/i&gt; leaks semaphore handles as well as memory, so the flush probably forgets to clean up a semaphore object...]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/pause-for-the-better#comment-152329">Marc</a>.</p>
<p>As far as I can see, <i><b>pause()</b></i> calls (a part of) <i><b>drawnow</b></i> to flush the queue. Interesting: with Process Explorer I found that <i><b>pause()</b></i> leaks semaphore handles as well as memory, so the flush probably forgets to clean up a semaphore object&#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/pause-for-the-better#comment-152351</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 05 Feb 2013 11:09:32 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3093#comment-152351</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/pause-for-the-better#comment-152329&quot;&gt;Marc&lt;/a&gt;.

@Marc - thanks for sharing. According to the patch description, it is not directly related to &lt;b&gt;&lt;i&gt;pause&lt;/i&gt;&lt;/b&gt;, but perhaps the issues are somehow related.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/pause-for-the-better#comment-152329">Marc</a>.</p>
<p>@Marc &#8211; thanks for sharing. According to the patch description, it is not directly related to <b><i>pause</i></b>, but perhaps the issues are somehow related.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Marc		</title>
		<link>https://undocumentedmatlab.com/articles/pause-for-the-better#comment-152329</link>

		<dc:creator><![CDATA[Marc]]></dc:creator>
		<pubDate>Tue, 05 Feb 2013 10:48:48 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3093#comment-152329</guid>

					<description><![CDATA[The following patch worked for me to correct this memory (and windows handle!) leak on 2012b:
http://www.mathworks.com/support/bugreports/819115

Since the problem seems to be inside &lt;i&gt;&lt;b&gt;drawnow&lt;/b&gt;&lt;/i&gt;, using sleep+&lt;i&gt;&lt;b&gt;drawnow&lt;/b&gt;&lt;/i&gt; probably doesn&#039;t help.]]></description>
			<content:encoded><![CDATA[<p>The following patch worked for me to correct this memory (and windows handle!) leak on 2012b:<br />
<a href="http://www.mathworks.com/support/bugreports/819115" rel="nofollow ugc">http://www.mathworks.com/support/bugreports/819115</a></p>
<p>Since the problem seems to be inside <i><b>drawnow</b></i>, using sleep+<i><b>drawnow</b></i> probably doesn&#8217;t help.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Doug		</title>
		<link>https://undocumentedmatlab.com/articles/pause-for-the-better#comment-149760</link>

		<dc:creator><![CDATA[Doug]]></dc:creator>
		<pubDate>Wed, 30 Jan 2013 20:18:15 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3093#comment-149760</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/pause-for-the-better#comment-114970&quot;&gt;Ang&lt;/a&gt;.

Thanks for the `drawnow;` recommendation! It made this all work perfectly for me.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/pause-for-the-better#comment-114970">Ang</a>.</p>
<p>Thanks for the `drawnow;` recommendation! It made this all work perfectly for me.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: kits		</title>
		<link>https://undocumentedmatlab.com/articles/pause-for-the-better#comment-118296</link>

		<dc:creator><![CDATA[kits]]></dc:creator>
		<pubDate>Fri, 02 Nov 2012 18:55:52 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3093#comment-118296</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/pause-for-the-better#comment-114970&quot;&gt;Ang&lt;/a&gt;.

Try adding a &quot;drawnow;&quot; in that loop?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/pause-for-the-better#comment-114970">Ang</a>.</p>
<p>Try adding a &#8220;drawnow;&#8221; in that loop?</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
