<?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: Erlang ring problem</title>
	<atom:link href="http://www.rodenas.org/blog/2007/08/27/erlang-ring-problem/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rodenas.org/blog/2007/08/27/erlang-ring-problem/</link>
	<description>Software Development Life Cycle: Methodologies and Tools for the Enterprise</description>
	<lastBuildDate>Sun, 07 Aug 2011 12:44:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: David Grenier</title>
		<link>http://www.rodenas.org/blog/2007/08/27/erlang-ring-problem/#comment-10074</link>
		<dc:creator>David Grenier</dc:creator>
		<pubDate>Sat, 11 Jun 2011 02:22:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.rodenas.org/blog/2007/08/27/erlang-ring-problem/#comment-10074</guid>
		<description>Hello,

The following implementation in C# using Rx.NET runs in 1min58 in LINQPad on quad core Q6600@2.4ghz:

var listeners =
	Enumerable.Range(0, 10000)
		.Select(_ =&gt; new Subject(Scheduler.TaskPool))
		.MemoizeAll();
		
listeners.Publish(o =&gt; o.Zip(o.Skip(1), (l, r) =&gt; new { l, r}))
	.Run(o =&gt; o.l.Subscribe(o.r));
	
Observable
	.Range(0, 10000)
	.Delay(TimeSpan.FromMilliseconds(1000))
	.Subscribe(listeners.First());
	
listeners.Last().Last().Dump();

I also have the following F# implementation running in 50s on the same machine (F# interactive):

type Agent = MailboxProcessor

let count = 10000
let now = System.DateTime.Now

Agent.Start (fun inbox -&gt;
    async {
        while true do
            let! msg = inbox.Receive()
            if msg = count then
                printfn &quot;%A&quot; (System.DateTime.Now - now).TotalMilliseconds })
&#124;&gt; Seq.unfold (fun next -&gt;
                let agent = Agent.Start (fun inbox -&gt;
                                async {
                                    while true do
                                        let! msg = inbox.Receive()
                                        next.Post msg } )
                Some (agent, agent))
&#124;&gt; Seq.nth count
&#124;&gt; (fun agent -&gt; for i in 1..count do agent.Post i)

Both code seems to scale pretty well versus the timing I had on my dual core laptop at work (T7400), although I only remember the time for the C#-Rx version at 5min50.

David</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>The following implementation in C# using Rx.NET runs in 1min58 in LINQPad on quad core <a href="mailto:Q6600@2.4ghz">Q6600@2.4ghz</a>:</p>
<p>var listeners =<br />
	Enumerable.Range(0, 10000)<br />
		.Select(_ =&gt; new Subject(Scheduler.TaskPool))<br />
		.MemoizeAll();</p>
<p>listeners.Publish(o =&gt; o.Zip(o.Skip(1), (l, r) =&gt; new { l, r}))<br />
	.Run(o =&gt; o.l.Subscribe(o.r));</p>
<p>Observable<br />
	.Range(0, 10000)<br />
	.Delay(TimeSpan.FromMilliseconds(1000))<br />
	.Subscribe(listeners.First());</p>
<p>listeners.Last().Last().Dump();</p>
<p>I also have the following F# implementation running in 50s on the same machine (F# interactive):</p>
<p>type Agent = MailboxProcessor</p>
<p>let count = 10000<br />
let now = System.DateTime.Now</p>
<p>Agent.Start (fun inbox -&gt;<br />
    async {<br />
        while true do<br />
            let! msg = inbox.Receive()<br />
            if msg = count then<br />
                printfn &#8220;%A&#8221; (System.DateTime.Now &#8211; now).TotalMilliseconds })<br />
|&gt; Seq.unfold (fun next -&gt;<br />
                let agent = Agent.Start (fun inbox -&gt;<br />
                                async {<br />
                                    while true do<br />
                                        let! msg = inbox.Receive()<br />
                                        next.Post msg } )<br />
                Some (agent, agent))<br />
|&gt; Seq.nth count<br />
|&gt; (fun agent -&gt; for i in 1..count do agent.Post i)</p>
<p>Both code seems to scale pretty well versus the timing I had on my dual core laptop at work (T7400), although I only remember the time for the C#-Rx version at 5min50.</p>
<p>David</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ernest Micklei</title>
		<link>http://www.rodenas.org/blog/2007/08/27/erlang-ring-problem/#comment-6830</link>
		<dc:creator>Ernest Micklei</dc:creator>
		<pubDate>Tue, 27 May 2008 12:22:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.rodenas.org/blog/2007/08/27/erlang-ring-problem/#comment-6830</guid>
		<description>Please have a look at my version:
http://philemonworks.wordpress.com/2008/05/23/ring-benchmark-my-first-concurrent-erlang/

I did not spend much time on gathering significant statistics. Getting a readable compact program was far more challenging.</description>
		<content:encoded><![CDATA[<p>Please have a look at my version:<br />
<a href="http://philemonworks.wordpress.com/2008/05/23/ring-benchmark-my-first-concurrent-erlang/" rel="nofollow">http://philemonworks.wordpress.com/2008/05/23/ring-benchmark-my-first-concurrent-erlang/</a></p>
<p>I did not spend much time on gathering significant statistics. Getting a readable compact program was far more challenging.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://www.rodenas.org/blog/2007/08/27/erlang-ring-problem/#comment-2047</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Thu, 30 Aug 2007 05:48:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.rodenas.org/blog/2007/08/27/erlang-ring-problem/#comment-2047</guid>
		<description>Your solution is clearer to me than the one over at http://muharem.wordpress.com/ though I found that a very interesting article, too.

Thanks for this. I&#039;m working my way through the book v-e-r-y slowly as coming from a purely flash development background almost all Erlang concepts are new on me.

But, damn, there&#039;s just something about erlang that makes me want to learn it!</description>
		<content:encoded><![CDATA[<p>Your solution is clearer to me than the one over at <a href="http://muharem.wordpress.com/" rel="nofollow">http://muharem.wordpress.com/</a> though I found that a very interesting article, too.</p>
<p>Thanks for this. I&#8217;m working my way through the book v-e-r-y slowly as coming from a purely flash development background almost all Erlang concepts are new on me.</p>
<p>But, damn, there&#8217;s just something about erlang that makes me want to learn it!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

