<?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: Counting Primes in Flash and Silverlight</title>
	<atom:link href="http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/feed" rel="self" type="application/rss+xml" />
	<link>http://www.itwriting.com/blog</link>
	<description>Tech writing blog</description>
	<lastBuildDate>Fri, 19 Mar 2010 05:25:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Foxy</title>
		<link>http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/comment-page-1#comment-173238</link>
		<dc:creator>Foxy</dc:creator>
		<pubDate>Sun, 14 Mar 2010 17:49:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.itwriting.com/blog/?page_id=677#comment-173238</guid>
		<description>I concur that the Javafx sample is unimpressive.

I intend to use the multithreading optimisation to give this a go myself.

Silverlight came out twice as fast using the example page.

Manufacturer Gigabyte Technology Co., Ltd. 
  Model GA-MA785GT-UD3H 
  Total amount of system memory 8.00 GB RAM 
  System type 64-bit operating system 
  Number of processor cores 4</description>
		<content:encoded><![CDATA[<p>I concur that the Javafx sample is unimpressive.</p>
<p>I intend to use the multithreading optimisation to give this a go myself.</p>
<p>Silverlight came out twice as fast using the example page.</p>
<p>Manufacturer Gigabyte Technology Co., Ltd.<br />
  Model GA-MA785GT-UD3H<br />
  Total amount of system memory 8.00 GB RAM<br />
  System type 64-bit operating system<br />
  Number of processor cores 4</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Helge Betzinger</title>
		<link>http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/comment-page-1#comment-145326</link>
		<dc:creator>Helge Betzinger</dc:creator>
		<pubDate>Thu, 08 Oct 2009 15:32:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.itwriting.com/blog/?page_id=677#comment-145326</guid>
		<description>Update: with silverlight3 its even more  impressive. Within Firefox 3 we have:
Flash10: Number of primes up to: 1000000 is 78498, counted in 1.247 secs.
Silverlight3: Number of primes up to: 1000000 is 78498, counted in 0.22 secs.
Adobe should take care for the performance of its JIT.</description>
		<content:encoded><![CDATA[<p>Update: with silverlight3 its even more  impressive. Within Firefox 3 we have:<br />
Flash10: Number of primes up to: 1000000 is 78498, counted in 1.247 secs.<br />
Silverlight3: Number of primes up to: 1000000 is 78498, counted in 0.22 secs.<br />
Adobe should take care for the performance of its JIT.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vodacoder</title>
		<link>http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/comment-page-1#comment-134066</link>
		<dc:creator>vodacoder</dc:creator>
		<pubDate>Sun, 07 Jun 2009 23:57:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.itwriting.com/blog/?page_id=677#comment-134066</guid>
		<description>the javafx sample isn&#039;t very impressive since it won&#039;t even come up....seems like it takes forever to load any of those javafx examples....not even in the same class as flex and silverlight.</description>
		<content:encoded><![CDATA[<p>the javafx sample isn&#8217;t very impressive since it won&#8217;t even come up&#8230;.seems like it takes forever to load any of those javafx examples&#8230;.not even in the same class as flex and silverlight.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aditya</title>
		<link>http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/comment-page-1#comment-120011</link>
		<dc:creator>Aditya</dc:creator>
		<pubDate>Thu, 29 Jan 2009 17:08:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.itwriting.com/blog/?page_id=677#comment-120011</guid>
		<description>Have you try it in JavaFX? Here is the Link:

http://javafx.com/samples/PrimeFactors/index.html

Try it! It really fast! Fastest than AdobeFlash, Microsoft Silverlight and JavaScript.</description>
		<content:encoded><![CDATA[<p>Have you try it in JavaFX? Here is the Link:</p>
<p><a href="http://javafx.com/samples/PrimeFactors/index.html" rel="nofollow">http://javafx.com/samples/PrimeFactors/index.html</a></p>
<p>Try it! It really fast! Fastest than AdobeFlash, Microsoft Silverlight and JavaScript.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: james</title>
		<link>http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/comment-page-1#comment-116665</link>
		<dc:creator>james</dc:creator>
		<pubDate>Sat, 20 Dec 2008 16:50:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.itwriting.com/blog/?page_id=677#comment-116665</guid>
		<description>&lt;code&gt;
	for (i=3; i  l2)
		{
			l++;
			l2=l*l;
		}

		numprimes++;

		for (j = 3; j &lt; l+1; j+=2)
		{
			if (i / j == 0)
			{
				numprimes--;
				break;
			}
		}
	}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><code><br />
	for (i=3; i  l2)<br />
		{<br />
			l++;<br />
			l2=l*l;<br />
		}</p>
<p>		numprimes++;</p>
<p>		for (j = 3; j &lt; l+1; j+=2)<br />
		{<br />
			if (i / j == 0)<br />
			{<br />
				numprimes--;<br />
				break;<br />
			}<br />
		}<br />
	}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: james</title>
		<link>http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/comment-page-1#comment-116664</link>
		<dc:creator>james</dc:creator>
		<pubDate>Sat, 20 Dec 2008 16:49:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.itwriting.com/blog/?page_id=677#comment-116664</guid>
		<description>whoops code got truncated, the loop should read:

&lt;code&gt;
	for (i=3; il2)
		{
			l++;
			l2=l*l;
		}

		numprimes++;

		for (j = 3; j &lt; l+1; j+=2)
		{
			if (i / j == 0)
			{
				numprimes--;
				break;
			}
		}
	}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>whoops code got truncated, the loop should read:</p>
<p><code><br />
	for (i=3; il2)<br />
		{<br />
			l++;<br />
			l2=l*l;<br />
		}</p>
<p>		numprimes++;</p>
<p>		for (j = 3; j &lt; l+1; j+=2)<br />
		{<br />
			if (i / j == 0)<br />
			{<br />
				numprimes--;<br />
				break;<br />
			}<br />
		}<br />
	}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: james</title>
		<link>http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/comment-page-1#comment-116661</link>
		<dc:creator>james</dc:creator>
		<pubDate>Sat, 20 Dec 2008 16:41:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.itwriting.com/blog/?page_id=677#comment-116661</guid>
		<description>Tweaking the code slightly to optimize unnecessary floating-point and calculations, I get (on my crappy little laptop):

C/x86    ~1s
C#/CLR   ~1s
JS/V8    ~1.5s
AS3/AVM2 ~3s

This benchmark on an x86 will generally end up with an inner loop of:

  idiv eax,ecx 
  test edx,edx 

I havent looked up the cycle counts, but I wouldn&#039;t expect modern CPU to heavily optimize integer division - as its pretty much a rare edge case.


Code (C#/C flavor):

int primes(int n)
{
	int numprimes=1;
	int l=2;
	int l2=l*l;
	int i;
	int j;

	for (i=3; il2)
		{
			l++;
			l2=l*l;
		}

		numprimes++;

		for (j = 3; j &lt; l+1; j+=2)
		{
			if (i % j == 0)
			{
				numprimes--;
				break;
			}
		}
	}
	return numprimes;
}</description>
		<content:encoded><![CDATA[<p>Tweaking the code slightly to optimize unnecessary floating-point and calculations, I get (on my crappy little laptop):</p>
<p>C/x86    ~1s<br />
C#/CLR   ~1s<br />
JS/V8    ~1.5s<br />
AS3/AVM2 ~3s</p>
<p>This benchmark on an x86 will generally end up with an inner loop of:</p>
<p>  idiv eax,ecx<br />
  test edx,edx </p>
<p>I havent looked up the cycle counts, but I wouldn&#8217;t expect modern CPU to heavily optimize integer division &#8211; as its pretty much a rare edge case.</p>
<p>Code (C#/C flavor):</p>
<p>int primes(int n)<br />
{<br />
	int numprimes=1;<br />
	int l=2;<br />
	int l2=l*l;<br />
	int i;<br />
	int j;</p>
<p>	for (i=3; il2)<br />
		{<br />
			l++;<br />
			l2=l*l;<br />
		}</p>
<p>		numprimes++;</p>
<p>		for (j = 3; j &lt; l+1; j+=2)<br />
		{<br />
			if (i % j == 0)<br />
			{<br />
				numprimes&#8211;;<br />
				break;<br />
			}<br />
		}<br />
	}<br />
	return numprimes;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/comment-page-1#comment-113774</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Fri, 14 Nov 2008 18:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.itwriting.com/blog/?page_id=677#comment-113774</guid>
		<description>I am actually looking for engineers interested in working on a new UI Platform product similar to Silverlight. Anyone interested?

-Ryan Phillips
engineerfinder@live.com</description>
		<content:encoded><![CDATA[<p>I am actually looking for engineers interested in working on a new UI Platform product similar to Silverlight. Anyone interested?</p>
<p>-Ryan Phillips<br />
<a href="mailto:engineerfinder@live.com">engineerfinder@live.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bart Czernicki</title>
		<link>http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/comment-page-1#comment-107812</link>
		<dc:creator>Bart Czernicki</dc:creator>
		<pubDate>Wed, 10 Sep 2008 01:42:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.itwriting.com/blog/?page_id=677#comment-107812</guid>
		<description>I took the code and wrote a detailed article on improving it with multithreading inside Silverlight.

&lt;a href=&quot;http://www.silverlighthack.com/post/2008/09/07/Silverlight-MultiThreading-with-a-Computational-Process-(Counting-Primes).aspx&quot; rel=&quot;nofollow&quot;&gt;http://www.silverlighthack.com/post/2008/09/07/Silverlight-MultiThreading-with-a-Computational-Process&lt;/a&gt;

I don&#039;t think that Flash/Flex have true multithreading...so this makes Silverlight even faster!  On my machine I got about a 100% improvement in speed.</description>
		<content:encoded><![CDATA[<p>I took the code and wrote a detailed article on improving it with multithreading inside Silverlight.</p>
<p><a href="http://www.silverlighthack.com/post/2008/09/07/Silverlight-MultiThreading-with-a-Computational-Process-(Counting-Primes).aspx" rel="nofollow">http://www.silverlighthack.com/post/2008/09/07/Silverlight-MultiThreading-with-a-Computational-Process</a></p>
<p>I don&#8217;t think that Flash/Flex have true multithreading&#8230;so this makes Silverlight even faster!  On my machine I got about a 100% improvement in speed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yitzchok</title>
		<link>http://www.itwriting.com/blog/articles/counting-primes-in-flash-and-silverlight/comment-page-1#comment-107008</link>
		<dc:creator>Yitzchok</dc:creator>
		<pubDate>Wed, 03 Sep 2008 04:38:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.itwriting.com/blog/?page_id=677#comment-107008</guid>
		<description>Google Chrome JavaScript (V8)

Number of primes up to: 1000000 is 78498, counted in 3.216 secs.</description>
		<content:encoded><![CDATA[<p>Google Chrome JavaScript (V8)</p>
<p>Number of primes up to: 1000000 is 78498, counted in 3.216 secs.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
